This is driving me nuts been at it for hours. its now 3:30am and i'm really tiered. so please mind the spelling.
I want the ability for people to upload tempoary files to my server.
So I went browesing (as you do) and came across 3 websites. I followed every instruction and still it doesn't work. I'm not very good with PHP so I will show you what I was given.
The form:
It didn't say if this had to be saved as a .php or .htm so i saved it as both and niether worked.
But of course it will not work without this next bit (which keeps coming up wrong)
This I saved as getfile.php now that is one of them here is the other
<html>
<head>
<title>Process Uploaded File</title>
</head>
<body>
I also saved this as getfile.php
Niether works.
Can anybody help me
Or make me one? I will pay 50 Frih$ or more if anybody can make me a working .php FILE/DOCUMENT and i want the files to be save in a folder called "uploads" in the same directory.
Thanks Daniel.
I want the ability for people to upload tempoary files to my server.
So I went browesing (as you do) and came across 3 websites. I followed every instruction and still it doesn't work. I'm not very good with PHP so I will show you what I was given.
The form:
| Code: |
| <form enctype="multipart/form-data" action="getfile.php" method="POST">
<input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> Send this file: <input name="userfile" type="file" /> <input type="submit" value="Send File" /> </form> |
It didn't say if this had to be saved as a .php or .htm so i saved it as both and niether worked.
But of course it will not work without this next bit (which keeps coming up wrong)
| Code: |
| <?php
//Сheck that we have a file if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) { //Check if the file is JPEG image and it's size is less than 350Kb $filename = basename($_FILES['uploaded_file']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 350000)) { //Determine the path to which we want to save this file $newname = dirname(__FILE__).'/upload/'.$filename; //Check if the file with the same name is already exists on the server if (!file_exists($newname)) { //Attempt to move the uploaded file to it's new place if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) { echo "It's done! The file has been saved as: ".$newname; } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists"; } } else { echo "Error: Only .jpg images under 350Kb are accepted for upload"; } } else { echo "Error: No file uploaded"; } ?> |
This I saved as getfile.php now that is one of them here is the other
<html>
<head>
<title>Process Uploaded File</title>
</head>
<body>
| Code: |
| <?php
if ( move_uploaded_file ($_FILES['uploadFile'] ['tmp_name'], "../uploads/{$_FILES['uploadFile'] ['name']}") ) { print '<p> The file has been successfully uploaded </p>'; } else { switch ($_FILES['uploadFile'] ['error']) { case 1: print '<p> The file is bigger than this PHP installation allows</p>'; break; case 2: print '<p> The file is bigger than this form allows</p>'; break; case 3: print '<p> Only part of the file was uploaded</p>'; break; case 4: print '<p> No file was uploaded</p>'; break; } } ?> </body> </html> |
I also saved this as getfile.php
Niether works.
Can anybody help me
Or make me one? I will pay 50 Frih$ or more if anybody can make me a working .php FILE/DOCUMENT and i want the files to be save in a folder called "uploads" in the same directory.
Thanks Daniel.
