Jump to content

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

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.