View Single Post
Old 08-10-2006, 09:48 PM  
Chris
Too lazy to set a custom title
 
Chris's Avatar
 
Industry Role:
Join Date: May 2003
Location: icq: 71462500 Skype: Jupzchris
Posts: 27,880
Quote:
Originally Posted by heywood
This should simplify it a bit.

Now I'm not sure, but removing the spaces might actually cause it to fail. It may need to retain those spaces to know where the file is.

Code:
<?php

// Where the file is going to be placed 
$target_path = "uploads/";

/* Add the original filename to our target path.  
Result is "uploads/filename.extension" */

$filename = $_FILES['uploadedfile']['name'];

$tempfilename = $_FILES['uploadedfile']['tmp_name'];

$tempfilename = str_replace(" ","", $_FILES['uploadedfile']['tmp_name']);

$target_path = "uploads/";

$target_path = $target_path . basename($filename); 



$target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

if(move_uploaded_file($tempfilename, $target_path)) {
    echo "The file ".  basename( $_FILES['uploadedfile']['name']). " has been uploaded";
} else{
    echo "There was an error uploading the file, please try again!";
}

?>
One thing you could do is, put a file renaming function in there.


hmm
did that and it renamed the file to

s3v%20c.jpgs3v%20c.jpg

lol

ah well ill look at this with a fresh head tommrow
__________________
[email protected]
Chris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote