leeser Posted April 23, 2009 Share Posted April 23, 2009 Hi guys, I really hope you can help me out. I have got this upload script, the only problem is that it doesn't upload the files. The folder it should upload to is 777. It insert a SQL entry as it should so I inly need the files to show up in my folder now <?php if(isset($_POST['upload'])) { $text = $_POST['titel']; mysql_connect("localhost", "m", "m") or die(mysql_error()); mysql_select_db("madebylasse_dk") or die(mysql_error()); mysql_query("INSERT INTO pixelbilleder (titel) VALUES ('$text')") OR DIE(mysql_error()); $id = mysql_insert_id(); $extension = 'jpg'; for($i = 1; $i <= 2; $i++){ if (move_uploaded_file($_FILES['minfil']['tmp_name'], '/customers/madebylasse.dk/madebylasse.dk/httpd.www/Billeder/' . $id . '-' . $i . '.jpg')) { echo 'Fil: ' . $i . ' - Uploaded'; }else{ echo 'Fil: ' . $i . ' - Error'; } } } else { ?> <form action="<? echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="multipart/form-data"> File 1: <input name="minfil[1]" type="file"><br /> File 2: <input name="minfil[2]" type="file"><br /> Titel: <input type="text" name="titel"><br /> <input type="submit" name="upload" value="Upload fil"> </form> <? } ?> Link to comment https://forums.phpfreaks.com/topic/155343-help-with-a-simpel-upload-script-that-doesnt-work/ Share on other sites More sharing options...
phpdragon Posted April 23, 2009 Share Posted April 23, 2009 customers/madebylasse.dk/madebylasse.dk/httpd.www/Billeder/ check that path to your directory, this does not look correct for example you have the domain name there twice in the directory path Link to comment https://forums.phpfreaks.com/topic/155343-help-with-a-simpel-upload-script-that-doesnt-work/#findComment-817277 Share on other sites More sharing options...
leeser Posted April 23, 2009 Author Share Posted April 23, 2009 I agree, but I did a http root-thing and that was the result of it? Link to comment https://forums.phpfreaks.com/topic/155343-help-with-a-simpel-upload-script-that-doesnt-work/#findComment-817314 Share on other sites More sharing options...
phpdragon Posted April 23, 2009 Share Posted April 23, 2009 replace this bit '/customers/madebylasse.dk/madebylasse.dk/httpd.www/Billeder/' with either '/Billeder/' or 'Billeder/' and see how you go you should only need the path from the main web directory Link to comment https://forums.phpfreaks.com/topic/155343-help-with-a-simpel-upload-script-that-doesnt-work/#findComment-817320 Share on other sites More sharing options...
PFMaBiSmAd Posted April 23, 2009 Share Posted April 23, 2009 You are not accessing the uploaded temp file correctly - This - $_FILES['minfil']['tmp_name'] should be - $_FILES['minfil']['tmp_name'][$i] Using full php error reporting when developing and debugging php code will help you find problems like this. Make sure that error_reporting is set to E_ALL and display_errors is set to ON in your php.ini (stop and start your web server to get any change made to php.ini to take effect) and make sure the php.ini that you are changing is the one php is using. Link to comment https://forums.phpfreaks.com/topic/155343-help-with-a-simpel-upload-script-that-doesnt-work/#findComment-817331 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.