stuckwithcode Posted January 23, 2010 Share Posted January 23, 2010 Hello, If a user uploads a file and the form doesn't process properly and there is an error is there a way for me to the save the file upload information so the user does not have to re-enter it. can this be done in js or php? Thanks Link to comment https://forums.phpfreaks.com/topic/189546-file-upload/ Share on other sites More sharing options...
teamatomic Posted January 23, 2010 Share Posted January 23, 2010 Fairly easy to do. $var=$_POST['var']; <input value="<?php echo "$var"; ?>"> if the form and the process are not in the same file then use a session var to store the values then repopulate the same as the example input. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/189546-file-upload/#findComment-1000486 Share on other sites More sharing options...
binumathew Posted January 23, 2010 Share Posted January 23, 2010 Use this Code for Uploading a file <?php echo "File Name: ".$_FILES[userfile][name]."<br>"; echo "tmp name: ".$_FILES[userfile][tmp_name]."<br>"; echo "File Type: ".$_FILES[userfile][type]."<br>"; echo "<br><br>"; $add="upimg/".$_FILES[userfile][name]; if(move_uploaded_file ($_FILES[userfile][tmp_name],$add)){ echo "Successfully uploaded the mage"; chmod("$add",0777); }else{echo "Failed to upload file Contact Site admin to fix the problem"; exit;} ?> Link to comment https://forums.phpfreaks.com/topic/189546-file-upload/#findComment-1000551 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.