stublackett Posted February 20, 2008 Share Posted February 20, 2008 Hi, I've got a script setup that collects the data submitted from the form The problem I've got is the image is just not going to the specified Folder The echo of $upfile I've got in the script is putting the image in /ideas/imagename.jpg But the Image is just not copying over Any ideas?? <?php #Script idea-submit.php //Collect Forms' Post Values $title = $_POST['title']; $description = $_POST['description']; $category = $_POST['category']; $img = $_FILES['image']['name']; //Validation Check //Check Ideas' Title if (!empty($_POST['title'])) { $title = ($_POST['title']); }else{ $title = NULL; echo "<p>You need to enter your ideas' title</p>"; } //Check Description if (!empty($_POST['description'])) { $description = ($_POST['description']); }else{ $description = NULL; echo "<p>You need to enter your ideas' description </p>"; } //Hanlde the Image $upfile = '/ideas/' .$_FILES['image']['name'] ; if (is_uploaded_file($_FILES['image']['tmpname'])) { if (!move_uploaded_file($_FILES['image']['tmpname'], $upfile)) { echo 'Problem : Could not move file to destination directory'; exit; } }else{ echo 'File Uploaded Succesfully<br><br>'; echo $upfile; Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/ Share on other sites More sharing options...
jscix Posted February 20, 2008 Share Posted February 20, 2008 Make sure the directory your uploading to has the correct privileges Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/#findComment-471552 Share on other sites More sharing options...
stublackett Posted February 20, 2008 Author Share Posted February 20, 2008 At the present moment, I'm doing everything on my LocalHost I did suspect that was the issue, but I can confirm it isnt as I've tried it also on my webhosting, With the folder permissions set to 7,7,7 and it definatley wasnt going Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/#findComment-471553 Share on other sites More sharing options...
jscix Posted February 20, 2008 Share Posted February 20, 2008 Change: $upfile = '/ideas/' .$_FILES['image']['name'] ; To $upfile = 'ideas/' .$_FILES['image']['name'] ; Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/#findComment-471556 Share on other sites More sharing options...
stublackett Posted February 20, 2008 Author Share Posted February 20, 2008 Still no joy there either > I was thinking it might just be down to the localhost settings, But I've tried again on the web and nothing Strange thing is though that the echo statement is actually outputting exactly where the file should be, Its just the Upload is definatley not going through "ideas/score.JPG" Being an example Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/#findComment-471559 Share on other sites More sharing options...
duclet Posted February 20, 2008 Share Posted February 20, 2008 Just to confirm, are you getting the message "File Uploaded Succesfully" right? Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/#findComment-471563 Share on other sites More sharing options...
stublackett Posted February 20, 2008 Author Share Posted February 20, 2008 Just to confirm, are you getting the message "File Uploaded Succesfully" right? Yeah the script is executing right the way down to "File Uploaded Succesfully" But its just not putting that file into the folder and the echo statement is definatley the folder I'd like it to go to Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/#findComment-471576 Share on other sites More sharing options...
duclet Posted February 20, 2008 Share Posted February 20, 2008 I see the problem now, it is "tmp_name" not "tmpname". Note the underscore. Link to comment https://forums.phpfreaks.com/topic/92084-upload-image/#findComment-471950 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.