Jump to content

PHP: How to move uploaded file to shared directory?

ffpc
Go to solution Solved by Elbstrand,

i already know that. but i dont know how to convert this "C:\Documents and Settings\All Users\Documents\My Pictures" to a php valid path.

 

Whats wrong with it?

"c:/Documents and Settings/All Users/Documents/My Pictures/" should work if thats the path.

can someone help me how can i set the path on my php script to move the uploaded files to my shared image directory. the location of my shared directory is this "C:\Documents and Settings\All Users\Documents\My Pictures"

Link to comment
Share on other sites

Link to post
Share on other sites

Maybe move_uploaded_file() is something that you'd be interested in?

See here for the php.net reference on it.

BUILD LOGS: HELIOS - Latest Update: 2015-SEP-06 ::: ZEUS - BOTW 2013-JUN-28 ::: APOLLO - Complete: 2014-MAY-10
OTHER STUFF: Cable Lacing Tutorial ::: What Is ZFS? ::: mincss Primer ::: LSI RAID Card Flashing Tutorial
FORUM INFO: Community Standards ::: The Moderating Team ::: 10TB+ Storage Showoff Topic

Link to comment
Share on other sites

Link to post
Share on other sites

Depends, but if you are moving an existing file, alpenwasser is right.

 

If you haven't written the file to disk at all however, there are other methods you can use

 

EDIT: If you simple want to move a file use "rename" or "copy" and "unlink" the old file

http://www.kavoir.com/2009/04/php-copying-renaming-and-moving-a-file.html

Christopher Kruse | Webdeveloper (Interface & Applications)
 
i7 3770k (3233C Batch) @ 4.2ghz | Asus P8Z77 WS | Gigabyte 780 Ti OC  | Corsair Vengeance LP 1600 32GB DDR3 | Samsung 850 EVO 500GB +2x Samsung 840 EVO 250GB + Samsung 830 256GB + 4x WD30EFRX, 2x WD30EZRX, 1xWD20EARS | Corsair AX750 + Bitfenix Extensions | Fractal Design Define XL R2 + Xigmatec 3in3 Hotswap Cage | Noctua NH-D15 + Thermal Grizzly Kryonaut, 5x Noctua NF-P14s redux-1500 PWM | Peripherals: Logitech G502 + Corsair K70 RGB + Red 40A-L O-Rings | Sound: Denon AVR 2807 via HDMI + 2x Nubert nuPro A-20 + 1x B&W CC6 Center | SoundMagic E10 | Jabra Speak 410

Link to comment
Share on other sites

Link to post
Share on other sites

Depends, but if you are moving an existing file, alpenwasser is right.

 

If you haven't written the file to disk at all however, there are other methods you can use

 

EDIT: If you simple want to move a file use "rename" or "copy" and "unlink" the old file

http://www.kavoir.com/2009/04/php-copying-renaming-and-moving-a-file.html

i already know that. but i dont know how to convert this "C:\Documents and Settings\All Users\Documents\My Pictures" to a php valid path.

Link to comment
Share on other sites

Link to post
Share on other sites

i already know that. but i dont know how to convert this "C:\Documents and Settings\All Users\Documents\My Pictures" to a php valid path.

 

Whats wrong with it?

"c:/Documents and Settings/All Users/Documents/My Pictures/" should work if thats the path.

Christopher Kruse | Webdeveloper (Interface & Applications)
 
i7 3770k (3233C Batch) @ 4.2ghz | Asus P8Z77 WS | Gigabyte 780 Ti OC  | Corsair Vengeance LP 1600 32GB DDR3 | Samsung 850 EVO 500GB +2x Samsung 840 EVO 250GB + Samsung 830 256GB + 4x WD30EFRX, 2x WD30EZRX, 1xWD20EARS | Corsair AX750 + Bitfenix Extensions | Fractal Design Define XL R2 + Xigmatec 3in3 Hotswap Cage | Noctua NH-D15 + Thermal Grizzly Kryonaut, 5x Noctua NF-P14s redux-1500 PWM | Peripherals: Logitech G502 + Corsair K70 RGB + Red 40A-L O-Rings | Sound: Denon AVR 2807 via HDMI + 2x Nubert nuPro A-20 + 1x B&W CC6 Center | SoundMagic E10 | Jabra Speak 410

Link to comment
Share on other sites

Link to post
Share on other sites

Whats wrong with it?

"c:/Documents and Settings/All Users/Documents/My Pictures/" should work if thats the path.

thx my problem was if i used the "\" instead the rest of the code will become comment so if i used "/" it will work just fine. thx

Link to comment
Share on other sites

Link to post
Share on other sites

thx my problem was if i used the "\" instead the rest of the code will become comment so if i used "/" it will work just fine. thx

 

In this case just double the backslash "\\" this should work just as well or use single quote instead of double quotes 'my code'

 

PS. Don't forget to mark the the topic as solved (click the solved button under the best answer).

Christopher Kruse | Webdeveloper (Interface & Applications)
 
i7 3770k (3233C Batch) @ 4.2ghz | Asus P8Z77 WS | Gigabyte 780 Ti OC  | Corsair Vengeance LP 1600 32GB DDR3 | Samsung 850 EVO 500GB +2x Samsung 840 EVO 250GB + Samsung 830 256GB + 4x WD30EFRX, 2x WD30EZRX, 1xWD20EARS | Corsair AX750 + Bitfenix Extensions | Fractal Design Define XL R2 + Xigmatec 3in3 Hotswap Cage | Noctua NH-D15 + Thermal Grizzly Kryonaut, 5x Noctua NF-P14s redux-1500 PWM | Peripherals: Logitech G502 + Corsair K70 RGB + Red 40A-L O-Rings | Sound: Denon AVR 2807 via HDMI + 2x Nubert nuPro A-20 + 1x B&W CC6 Center | SoundMagic E10 | Jabra Speak 410

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×