Image Upload Script?

  • Thread starter Thread starter Twiffles
  • Start date Start date
  • Views Views 1,458
  • Replies Replies 1

Twiffles

танковые победы
Member
Joined
Sep 6, 2007
Messages
1,926
Solutions
1
Reaction score
43
Trophies
1
XP
1,335
Country
Gambia, The
I've been trying to find/make a simple PHP script that'll upload a picture, rename it with a random short name, then display the direct URL if it is successful.
So far, I got to the upload part. It'll upload the picture, but it'll keep the original file name and won't spit out a URL. Just a success message.

Which leads to my question: Does anyone have/know where to find a script that can do such a task?

Thanks :x

EDIT: Well, I figured out how to rename the file after upload. Now I just need a way to show me the URL to the image. xD
 
I found this on php.net, if you use a form with method POST :

CODEIt check if the uploaded file is correctly uploaded, and if it is, move it to the specified folder, so you could know the path to the file.

http://fr2.php.net/manual/en/features.file...post-method.php
http://fr2.php.net/manual/en/function.move-uploaded-file.php


$_FILE is an array with all the data from all the uploaded files (if there were many picture at once for example).
You can check the array in comment from 18 mars 2009 :
http://fr2.php.net/manual/en/reserved.variables.files.php

$_FILE[name of the 'type=file' input][$_FILE array name]
 

Site & Scene News

Popular threads in this forum