/    Sign up×
Community /Pin to ProfileBookmark

looking for some good file uplaod how-to’s. have searched the internet and have found very little. does anybody have any good links for this or how-tos they can post?

Not looking for a script, looking to learn how to write a script.

thx

to post a comment
PHP

10 Comments(s)

Copy linkTweet thisAlerts:
@MstrBobOct 03.2004 — Did you try the PHP manual (PHP.net)?

http://us4.php.net/features.file-upload
Copy linkTweet thisAlerts:
@DARTHTAMPONauthorOct 03.2004 — for the html side MAX_FILE_SIZE, if I have more than 1 file to uplad can i put different sizes for each. Will this give me an error or use the same file size for all of the files.
Copy linkTweet thisAlerts:
@MstrBobOct 03.2004 — MAX_FILE_SIZE is more important to the browser. If you have multiple upload inputs, than I'd say that your best bet is to have MAX_FILE_SIZE equal the max file size of the largest file. If you want the other uploads to have smaller max file size, tell the user the max file size for those uploads, and then check the individual files in your PHP. But only have one max file size input tag.
Copy linkTweet thisAlerts:
@DARTHTAMPONauthorOct 08.2004 — Changing upload_tmp_dir in php.ini allows you to change the directory where files go when uploaded.

Is there a way to change it in a program, so if i have 5 different upload utilites each can have their own file upload directory?
Copy linkTweet thisAlerts:
@Paul_JrOct 08.2004 — [font=palatino linotype]The [font=courier]upload_tmp_dir[/font] directive is just the temporary upload directory; after the file is uploaded to that temporary directory, you copy it over to your desired directory.[/font]
Copy linkTweet thisAlerts:
@DARTHTAMPONauthorOct 09.2004 — Can I use actual command line code?

mv -f location1/filename location2/differentfilename

and is this command correct, can I change a filename on a move.
Copy linkTweet thisAlerts:
@Paul_JrOct 09.2004 — [i]Originally posted by DARTHTAMPON [/i]

[B]Can I use actual command line code?



mv -f location1/filename location2/differentfilename



and is this command correct, can I change a filename on a move. [/B]
[/QUOTE]

[font=palatino linotype]I couldn’t say; I’ve never used PHP through the command line. Sorry.[/font]
Copy linkTweet thisAlerts:
@drythirstOct 09.2004 — What's PHP through the command line code?? Whoa, sounds old...

Or are you talking about the PHP command line codes???

? ? ? ? ? ?
Copy linkTweet thisAlerts:
@MstrBobOct 09.2004 — Why not simply use the [URL=http://us2.php.net/manual/en/function.move-uploaded-file.php]move_uploaded_file()[/URL] function? You can rename a file easily enough, as well
Copy linkTweet thisAlerts:
@DARTHTAMPONauthorOct 10.2004 — ok so I have this code====

$uploadfiles = array("logosmall", "logomedium", "logolarge", "about");

$filenameextension = array("s_", "m_", "l_", "a_");

$files = array();

getfileinfo($files, $uploadfiles, $filenameextension);


function getfileinfo (&$files, $uploadfiles, $filenameextension)

{

for ($x = 0; $x < sizeof($uploadfiles); $x++)

{

if( !(strlen($_FILES[$uploadfiles[$x]]['name']) < 1 ))

{

$files[$x][0] = $_
FILES[$uploadfiles[$x]]['name']; # name of file

$files[$x][1] = $_FILES[$uploadfiles[$x]]['type']; # file type jpg gif etc

$files[$x][2] = $_
FILES[$uploadfiles[$x]]['size']; # size of file

$files[$x][3] = $_FILES[$uploadfiles[$x]]['tmp_name']; # temp name of file on server

$files[$x][4] = $_
FILES[$uploadfiles[$x]]['error']; # errors

# move file from temp directory to the temp directory of this file


if (move_uploaded_file($_FILES[$uploadfiles[$x]]['name'], $_SERVER['PHP_SELF']."/temp/".$filenameextension[$x].$files[$x][0]))

{

echo "yes";

}

else

{

echo "no";

}

echo $_SERVER['PHP_SELF']."/temp/".$filenameextension[$x].$files[$x][0]."<br>";

}

}


now all of the information comes out correct the output on the page becomes /caboo/db_input/brands/brand2.php/temp/s_test.txt when i try to upload a text file called test. everything seems to look fine but no file is ever uploaded. The temp directory i created i chmod 777. does anybody see anything that might be wrong or can anybody give me a clue
×

Success!

Help @DARTHTAMPON spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.27,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...