fekaduw Posted April 1, 2007 Share Posted April 1, 2007 hello everyone, i just have a php code that will upload a file to a certain folder in my server. The code worked fine for sometime and now it will simply store a file named 1,2... instead of the actual file name. The numbered file is not a valid file format. Here is the code: if($_FILES['fname']['name']=!"") copy($_FILES['fname']['tmp_name'],"membersupload/".$_FILES['fname']['name']) or die("Could not copy file"); any help is highly appreciated! thanks Link to comment https://forums.phpfreaks.com/topic/45162-any-help-on-file-upload/ Share on other sites More sharing options...
MadTechie Posted April 1, 2007 Share Posted April 1, 2007 post all the code Link to comment https://forums.phpfreaks.com/topic/45162-any-help-on-file-upload/#findComment-219232 Share on other sites More sharing options...
fekaduw Posted April 1, 2007 Author Share Posted April 1, 2007 i have two pages. One containing the form and the other the uploader. The Form <html> <head> <title>Specify - Members Area</title> <link href='style/specify.css' rel='stylesheet' type='text/css' /> <script language='javascript'> function checkinput() { if(frmuploadfile.fname.value=='') { alert('Select a file to send'); return false; } frmuploadfile.document.submit(); return true; } </script> </head> <body class='body-home' topmargin='0' rightmargin='0' leftmargin='0'> <p class='uploadfile'>Select the files that you want to send us so that we will update your information on our site or add new products, news and the like regarding your products </p> <form name='frmuploadfile' action='fileuploader.php' method='post' enctype='multipart/form-data'> <table border='0'> <tr> <td align='right'>Attach Files:</td> <td><input type='file' name='fname'></td> </td> <tr> <td> <input type='hidden' name='userName' value='".$userName."'></td> <td><input type='submit' value='Upload File' class='loginbtn' onclick='return checkinput();'></td> </tr> </table> </form> </body> </html> The uploader: fileuploader.php if($_FILES['fname']['name']=!"") { copy($_FILES['fname']['tmp_name'],"membersupload/".$_FILES['fname']['name']) or die("Could not copy file"); Link to comment https://forums.phpfreaks.com/topic/45162-any-help-on-file-upload/#findComment-219241 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.