Jump to content


Photo

Uploads


  • Please log in to reply
2 replies to this topic

#1 DeathRay2K

DeathRay2K
  • Members
  • 96 posts
  • Location:Canada
  • Projects:D2K Studios, Xaeon Mod, Unseen Presence, Rhythm Mixer, Website Designs, CSS OS

Posted 11 July 2006 - 04:25 AM

Alrighty, I've made a very basic upload script, but it doesn't work. :(
Any help would be greatly appreciated!

Here's what I have
				$target_path = "uploads/";
				$path_parts = pathinfo($_FILES['uploadedfile']['tmp_name']);
				$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 
				
				if($_POST['MAX_FILE_SIZE'] >= filesize($_FILES['uploadedfile']['tmp_name']) && !in_array($path_parts['extension'], $badextensions))
				{
					if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
					?>
						html stuff...
					<?
					} else{
						echo "There was an error uploading the file, please try again!";
					}
				}
				else
				{
					echo "File can not be uploaded.";
				}

The uploads directory is chmodded to 777, at least for now. It always shows "There was an error uploading the file, please try again!"...

Oh, I should probably mention that I diddly-squat experience and knowledge of uploads... :mellow:

Edited by DeathRay2K, 11 July 2006 - 05:06 AM.


#2 Blodo

Blodo

    The one who disagrees

  • Project Team
  • 3,002 posts
  • Location:Eastern Europe
  • Projects:siteMeister, Mental Omega
  •  The wise guy

Posted 11 July 2006 - 04:04 PM

As far as I know, the uploads path needs to be absolute. I may be wrong though.

ARGUMENT FROM CREATION, a.k.a. ARGUMENT FROM PERSONAL INCREDULITY (I)
(1) If evolution is false, then creationism is true, and therefore God exists.
(2) Evolution can't be true, since I lack the mental capacity to understand it; moreover, to accept its truth would cause me to be uncomfortable.
(3) Therefore, God exists.


#3 DeathRay2K

DeathRay2K
  • Members
  • 96 posts
  • Location:Canada
  • Projects:D2K Studios, Xaeon Mod, Unseen Presence, Rhythm Mixer, Website Designs, CSS OS

Posted 11 July 2006 - 06:22 PM

Heh, nevermind, it was a type in the HTML form, I name the file input "uploadedfle"... :p

Edited by DeathRay2K, 11 July 2006 - 06:22 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users