LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-13-2016, 01:12 PM   #1
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

Rep: Reputation: 12
PHP Upload - Unable to determine path of browsed directory - How to get it?


I am uploading image files using PHP script.

The first thing you see is the FORM with the BROWSER button.

Pressing this button enables you to pick any directory on your computer to choose files from.

Although you do not need to know where these image files come from to upload them, I need to know the directory and path information so I can pass that on to another PHP script which pre-pends the exif timestamp to the filename of the image.

The $_FILES structure doesn't have that information.
 
Old 08-13-2016, 01:52 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,263
Blog Entries: 24

Rep: Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194Reputation: 4194
You can't get the path passed with the file.

The HTML file element, the browse button, is specifically designed to prevent passing the path information because that represents a security leak.
 
Old 08-13-2016, 03:00 PM   #3
pizzipie
Member
 
Registered: Jun 2005
Location: Hayden, ID
Distribution: Ubuntu 20.04
Posts: 441

Original Poster
Rep: Reputation: 12
SOLVED:

Thanks, that's disappointing, guess I'll just have to enter that manually.

R
 
Old 08-14-2016, 12:39 AM   #4
NevemTeve
Senior Member
 
Registered: Oct 2011
Location: Budapest
Distribution: Debian/GNU/Linux, AIX
Posts: 4,862
Blog Entries: 1

Rep: Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869Reputation: 1869
> pre-pends the exif timestamp to the filename of the image.

You can rename file '/home/tedd/photos/sunset.jpg' to '/home/tedd/photos/20160807_sunset.jpg' without knowing the path on the remote computer (eg C:\PICS\HAWAII\AUGUST\2016\)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to upload files through PHP gokultm Red Hat 5 01-12-2012 04:46 AM
Apache - a default index.cgi when directory is browsed? spampig Linux - Server 2 05-20-2010 12:53 PM
unable to upload using copy php helpme0904 Linux - Newbie 5 01-06-2006 02:23 PM
path to PHP src directory in RedHat 9? robert_speer Red Hat 0 08-03-2005 02:06 PM
PHP: simplest way to limit uploads to upload directory J_Szucs Programming 3 11-11-2003 02:15 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:11 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration