Uploading Image Files

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Grigory
New php-forum User
New php-forum User
Posts: 6
Joined: Tue Nov 26, 2002 1:40 pm
Contact:

Uploading Image Files

Postby Grigory » Thu Dec 05, 2002 10:47 am

I'm using a form to upload image files from the users computer to a web server. I'm a little confuse though. I believe I can use the copy function but I dont not know what I need to put in the destination path name. For example...

Let's just say my webspace server is http://www.Grigory.com

In the destination path name would I put "www.grigory.com/$image"???
or put "http://www.grigory.com/$image"
or maybe "ftp://www.grigory.com/$image"

If you were to just use say "images/$image" would that upload it from the directory that this php script is in?

I hope someone can shed some light on this for me

Dmitrit Plakhotnik
New php-forum User
New php-forum User
Posts: 13
Joined: Fri Nov 01, 2002 6:56 am

Postby Dmitrit Plakhotnik » Fri Dec 06, 2002 3:43 am

For upload images or other you must:

create upload form
<form method=post action='upload.php' ENCTYPE='multipart/form-data' >
<input type='file' name=uptmp value='UPLOAD'>
<input type='submit' name='submitButtonName' value='SAVE'>
</form>

after in upload.php use $uptmp for get place where server copy data
and copy it where you need

$uptmp - path and filename on server
$uptmp_name - original filename
<?
copy($uptmp, "images/".$uptmp_name);
?>
[/code]


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests

cron