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 var_dump($_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
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.
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.
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.
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.
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.
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.
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 49
but still no file was uploaded and nothing echoed, the word document gave this
array
‘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 0
once 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.