Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg - to upload image path

2005-02-10 Thread Martin Norland
ioannes wrote:
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.
Maybe it's just early, and I haven't had my caffeine yet - but it seems 
to me something fairly basic is being overlooked...

a web browser doesn't even give you this information!
if you really need it, for whatever reason, you're going to have to pull 
the information out of the file input through javascript.  IIRC you can 
read from a file input, but I know for a fact you can't change it (at 
least, not without perhaps an exploit or some horrible activex 
why_would_this_ever_be_enabled_microsoft_you_fools() function calls.)

You're better off providing keywords, categories, folders or labels to 
go along with the images for your users, instead of trying to match 
their organization with yours.

Cheers,
--
- Martin Norland, Database / Web Developer, International Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg-to upload image path

2005-02-10 Thread Martin Norland
ioannes wrote:
OK.  Makes sense, since I needed to change the form tag to upload files. 
Clearly, then it was not uploading the path.

Thanks
If by local, in your example, you mean it gives you pic1.jpg - then 
I will agree.  No browser I've ever seen sends 
C:\pics\subdir\pic1.jpg. It will *display* that to the user, but it 
doesn't submit the local path, it just uploads the file and gives the 
filename.

No problem.
In the future, unless you have a specific reason to take a mailing 
off-list, please leave it so others can reply to it or find the answers 
/ solutions / clarification when searching archives and the likes.  It's 
just polite :)
(this is part of why I try to always set the reply-to to the list)

Cheers,
--
- Martin Norland, Sys Admin / Database / Web Developer, International 
Outreach x3257
The opinion(s) contained within this email do not necessarily represent 
those of St. Jude Children's Research Hospital.

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


Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg - to upload image path

2005-02-10 Thread J R
now if you must have the local path of your file here's a rough code
to give you an idea using javascript, then just have it php control it
on the server side.

form action= method=post enctype=multipart/form-data name=form_upload
input type=file name=file_upload onChange=javascript:
document.forms[0].file_upload_path.value =
document.forms[0].file_upload.value
input type=text name=file_upload_path value=
/form

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



[suspicious - maybe spam] [PHP-DB] [suspicious - maybe spam] Re: [PHP-DB] Reg Exp to change c:\dir\dir\pic.jpg to dir/pic.jpg - to upload image path

2005-02-09 Thread J R
hi you don't have to bother your self of such things. html does it all
for you. All you have to do is manage the uploaded file which is put
as a temporary file on the server temporary folder. Here's some tip:

temporary file in your server: $_FILES[file][tmp_name] 
name of your file (the uploaded): $_FILES[file][name]

now use move_uploaded_file  function to where ever location you want
to put your file on your server.

 http://ph.php.net/manual/en/function.move-uploaded-file.php  


cheers!



On Wed, 09 Feb 2005 14:44:07 -0500, Bastien Koert [EMAIL PROTECTED] wrote:
 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 [EMAIL PROTECTED]
 To: php-db@lists.php.net
 Subject: [PHP-DB] 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 -
 
 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
 
 


-- 
GMail Rocks!!!

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