RE: Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg - to upload image path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Whats the reason to keep the image path from the host pc?

The server will dump the uploaded file into a temp area fro which you can either move it to a permanent dir or load it into a db. The only path that you really need to worry about the one on the server, which you can handle by

1. leaving it fixed and coding it into your scripts
2. make it somewhat variable (if you were storing images by username or something like that) which you can handle by storing in the db.



Once the image is uploaded, there is no use for the user's path. If he changes OSs its gone and of no value...


Bastien



From: "ioannes" <ioannes@xxxxxxxxxxxxxx>
To: <php-db@xxxxxxxxxxxxx>
Subject: Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg - to upload image path
Date: Wed, 9 Feb 2005 19:14:14 -0000


I am trying to upload images - in fact an image path - from a PC.

I use the <input > tag:

<INPUT NAME="addpic" TYPE="file">

which nicely gives an input textfield and Browse button! This gives me, in the input box, eg:

c:\pics\subdir\pic1.jpg

The relative path on the server is something like:

subdir/pics1.jpg

thus I need to transform the string:

c:\subdir\pics\pics1.jpg

into:

pics/pics1.jpg


I can use str_replace() to change "\" into "/". I am looking for an expression from some clever person to get rid of "c:\subdir\" given that I don't know the exact 'subdir' or name of the image.


Regards,

John

-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux