usadarts Posted February 18, 2008 Share Posted February 18, 2008 Good Evening All, I have a form in which I need to be able to upload a file to a specified folder (uploads) and put the file name in a database field. How is this done? Any examples for me to view? Thanks, David Quote Link to comment Share on other sites More sharing options...
priti Posted February 18, 2008 Share Posted February 18, 2008 you can follow http://www.tizag.com/phpT/fileupload.php Quote Link to comment Share on other sites More sharing options...
usadarts Posted February 18, 2008 Author Share Posted February 18, 2008 Thank you for the link....... What is this telling me?? Warning: move_uploaded_file(calendar/pictures 151.jpg) [function.move-uploaded-file]: failed to open stream: No such file or directory in /home/website/public_html/calendar/postinfo.php on line 22 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpN6uVrD' to 'calendar/pictures 151.jpg' in /home/website/public_html/calendar/postinfo.php on line 22 There was an error uploading the file, please try again!Test Tournament loaded to databaseBack to Calendar Control Panel Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 18, 2008 Share Posted February 18, 2008 you need to set this correctly to the correct folder $target_path = "uploads/"; you might also need to use CHMOD to set the folder to 777 to have full access to it... Quote Link to comment Share on other sites More sharing options...
usadarts Posted February 18, 2008 Author Share Posted February 18, 2008 I changed the $target_path = "uploads/"; to calendar I also have permissions for calendar set at 777 <input name="uploadedfile" type="file"> $target_path = "calendar/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 18, 2008 Share Posted February 18, 2008 $target_path = "calendar/"; look agin you speel calender two diffrent ways cheek folder spelling agin mate......... Quote Link to comment Share on other sites More sharing options...
redarrow Posted February 18, 2008 Share Posted February 18, 2008 also try CHMOD($filename,777); or CHMOD($filename,0777); Quote Link to comment Share on other sites More sharing options...
usadarts Posted February 18, 2008 Author Share Posted February 18, 2008 Excellent....I got ride of most of the errors.....I just have this..... There was an error uploading the file, please try again! loaded to database I will figure this out.....thanks again! 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.