Jump to content

Any help on file upload?


fekaduw

Recommended Posts

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

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");

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.