Jump to content

[SOLVED] Image upload directory problem


RyanW67

Recommended Posts

Dear all,

 

I'm quite a php noobie, have used a tutorial to construct a php image uploader. Though I'm now faced a problem regarding the directory where the image is uploaded to...

 

I have the variable $folder which holds the address of the web folder in which the image is to be uploaded to... However the image will only upload when this variable is set to a folder which is in the same folder as the upload script.... for example I have a secure area/folder called CMS, in this I have the upload file and the upload folder (images), however I don't want to the upload folder to be in the secure area (as it wouldn't allow visitors to see the images) so instead I have tried changing the variable to say

 

$folder = "http://www.myhost.co.uk/images/";

 

instead of

 

$folder = "http://www.myhost.co.uk/CMS/images/"; (which works fine)...

 

Does this mean I have to upload to wherever my script is?

 

Thanks in advance :)

 

Ryan

Link to comment
https://forums.phpfreaks.com/topic/72098-solved-image-upload-directory-problem/
Share on other sites

yes, you have to upload to where ever your script is, your better off making your secure folder just a normal folder, and make a login script for people to access different folders. Works better, it may take awhile to code, but its much more effective.

 

Regards ACE

No; you don't have to..

But use "../" to get from a folder to another..  Example:

the script path: /alfa/beta/upload.php

Wanted image path: /alfa/charlie/images/

then you have to set $folder = '../charlie/images/';

 

../ means "one directory down"

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.