RTS Posted December 31, 2006 Share Posted December 31, 2006 So I have a simple PHP upload form ( The code below ), that uploads to a folder called files. The problem is that every file that is uploaded doesn't work any more when uploaded in files. How can I fix this?[code]<?PHP$target_path = "files/";$target_path = $target_path . basename( $_FILES['Filedata']['name']); if(move_uploaded_file($_FILES['Filedata']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['Filedata']['name']). " has been uploaded";} else{ echo "There was an error uploading the file, please try again!";}?>[/code] Quote Link to comment Share on other sites More sharing options...
fert Posted December 31, 2006 Share Posted December 31, 2006 are you sure the form has the enctype="multipart/form-data" attribute? Quote Link to comment Share on other sites More sharing options...
RTS Posted December 31, 2006 Author Share Posted December 31, 2006 yea, it does Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted December 31, 2006 Share Posted December 31, 2006 This is probably a permissions problem with the folder. What type of files are these and what exactly do you mean - [quote]every file that is uploaded doesn't work any more[/quote] Quote Link to comment Share on other sites More sharing options...
RTS Posted December 31, 2006 Author Share Posted December 31, 2006 I have chmoded the folder to 777, and the files that I have tried uploading are swf, and avi files as these are the types my site will be working with. Quote Link to comment Share on other sites More sharing options...
Nicklas Posted December 31, 2006 Share Posted December 31, 2006 correct me if i'm wrong, but if I remember correctly, the maximum allowed filesize is 2Mb. If your files go beond that, they wont be uploaded unless you edit your php.ini to allow bigger filesizes. Quote Link to comment Share on other sites More sharing options...
RTS Posted December 31, 2006 Author Share Posted December 31, 2006 they are smaller thann 2mb tho like 500 kb Quote Link to comment Share on other sites More sharing options...
Flava Posted December 31, 2006 Share Posted December 31, 2006 Not a problem with your variables is it?On an old web server of mine I had to request the file names and such using$filedata = $_REQUEST['filedata'];.etcBut if your variables are fine then I'm not sure what the problem may be. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.