Hi to all you helpful people here at sitepoint, I keep putting this to the back burner, but now that I've had so much help with other problems that are now all sorted out I thought it was time to address this once again. Firstly is it possible to upload a video file to the same machine i.e. I'm running windows 7 with wamp server as my testing or development server and I want to upload a video file from a second hard drive, can that be done? I know theres a ton of tutorials out there, to show how to do this, however, I just simply can't get it to work. I've changed the php.ini file to allow up to 500mb both the post data size and max allowed file size, there may be other setting in the php.ini file that need to change as well but I don't know what. The best I've been able to get is a blank page loaded with no errors and nothing echoed and definetly no file in the upload directory. As I've hacked most of the tutorials to bits, trying to get it to work, I don't have any php to post here, But I do have the form that I'm using, maybe one of you gurus might be able to write me something for it, here it is

So after you attempt to upload have your tried copying the the tmp file to a new location or it just doesn't work? This process should not care whether it is uploading it to the same or remote machine. I have this working on the same machine, but I use Linux, so it may be different.

Have you output $FILES by using vardump($_FILES) after you post this should look something like:

Thanx for the reply Server Storm, yes I have tried moving the tmp file with very similar code to what you just posted, but I haven't used the var_dump($_FILES) as its not something I'm very familiar with, only come across it once before, and I didn't understand it back then, this is all very new to me, as I'm trying to teach myself. However, I'll copy this across and get back to you soon.Cheers

studentofIT
—
2012-05-28T23:14:34Z —
#4

Ok I just got "array empty" and an error undefined index upload on this line "if($_FILES['upload']['name'] != ''){" .Cheers

studentofIT
—
2012-05-30T07:35:20Z —
#5

I've managed to get the undefined index error fixed by changing the above php code to what I've posted underneath, however, the var_dump($_FILES) says the array is still empty, I did some googling and found out that the post data size needs to be greater than the max allowed file size, so I corrected that by increasing the post data size by 100mb, but still no file uploaded and array empty, what needs to be done to get array to show a string?Here's the code I changed.

This code is by no means secure and still needs more work but I'll leave that up to you.

studentofIT
—
2012-05-30T10:43:35Z —
#7

Hi Codarz360, thankyou very much for your effort, but unfortunately it still does not work, you seem to have written this as if all the code is on the same page, it is not, the html form is on a completely seperate page to the php. And when I added the var_dump($_FILES); to your code I'm still getting array empty!!! Nothing echoed and no uploaded video. It'exactly the same as if I was still using my code. Cheers

Codarz360
—
2012-05-30T10:52:44Z —
#8

studentofIT said:

Hi Codarz360, thankyou very much for your effort, but unfortunately it still does not work, you seem to have written this as if all the code is on the same page, it is not, the html form is on a completely seperate page to the php. And when I added the var_dump($_FILES); to your code I'm still getting array empty!!! Nothing echoed and no uploaded video. It'exactly the same as if I was still using my code. Cheers

Thanx Codarz360 but I put it into 2 pages when I tested it before, I don't think the problem is with the code, I think it might be more to do with the php.ini file or maybe permissions or something like that, it really beats me as to why it shows the array as empty. Cheers mate.

Codarz360
—
2012-05-30T12:13:52Z —
#10

Ok here is a link to everything that is in my PHP.ini file on my WAMP server http://pastebin.com/rZLsMgmn just copy and paste that over yours and test to see if it works correctly.

tom8
—
2012-05-30T12:33:27Z —
#11

Your upload_max_filesize = 2M. That is somewhat small for video file. Perhaps you need to set it to a larger number.

studentofIT
—
2012-05-30T12:41:59Z —
#12

Firstly, what version of php is this? Secondly, how big a file have you been using to try this with as your max allowed file size is still set at 2mb where I have mine set to 500mb and I've been trying to upload an 18mb file, as its getting rather late here now, I won't be back to reply until the morning. Cheers mate.

studentofIT
—
2012-05-30T12:43:06Z —
#13

Beat me to it tom8 .Cheers mate

Codarz360
—
2012-05-30T13:00:08Z —
#14

I've just been uploading a small text file that is why it is still set to 2MB. It's been working fine with the text file and maybe you want to try it using a text file to test your settings are correct.

StarLion
—
2012-05-30T13:03:53Z —
#15

You do realize your form's max file size is set to 500k, not 500M, right? That number is measured in B, not KB.

Codarz360
—
2012-05-30T13:35:53Z —
#16

So then that would mean that in order to equal 500MB you would need to set the form value to 524,288,000 bytes?

StarLion
—
2012-05-30T13:38:04Z —
#17

correct.

Codarz360
—
2012-05-30T13:46:54Z —
#18

I think that this should solve your problem then studentofIT.

Changed the value of the MAX_FILE_SIZE to 524288000 bytes which should now allow you to upload your file.

I've tested it out now with a 6.75mb .mp4 file and everything seems to working ok.

studentofIT
—
2012-05-31T02:31:28Z —
#19

Thanx StarLion, I was wondering about that, I did have it set at 500mb at one stage, but I think I changed it back again before I tested, Codarz360 there is no need to keep posting the same code over again, as there is nothing wrong with my code, except for the max file size limit as just mentioned by StarLion, I will be using that. Now all I have to do is change it and test it. Be back soon with the results. Cheers very muchly guys.

studentofIT
—
2012-05-31T05:09:22Z —
#20

Ok changing the form to 500000000 bytes had no effect whatsoever, however, I did what Codarz360 suggested and tried 2 smaller files, seperately of course, the first one was a .txt file, the size was just 49bytes, and the second was a microsoft word document, the size was 2.22mb, the .txt file gave this array 'upload' => array 'name' => string 'Rockbits URL.txt' (length=16) 'type' => string 'text/plain' (length=10) 'tmp_name' => string 'C:\wamp\ mp\phpC5C5.tmp' (length=23) 'error' => int 0 'size' => int 49but still no file was uploaded and nothing echoed, the word document gave thisarray 'upload' => array 'name' => string 'All great websites have a great server behind them2.docx' (length=56) 'type' => string '' (length=0) 'tmp_name' => string '' (length=0) 'error' => int 1 'size' => int 0once again no file uploaded and nothing echoed here either, obviously the word document didn't even get to the tmp dir and showing an error with no size at all, the .txt file made it to the tmp dir with no errors and there wasn't a problem with it recognisining the size, so beats me as to whats going on.