Codeigniter upload path invalid on webserver but valid on local host - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Codeigniter upload path invalid on webserver but valid on local host (/showthread.php?tid=54746) |
Codeigniter upload path invalid on webserver but valid on local host - El Forum - 09-23-2012 [eluser]Dandy_andy[/eluser] I’m hoping someone can help me here as I’m pretty desperate now. Having tested my website on my localhost with no issues whatsoever, I have a photo upload function which doesn’t work now the site is on a remote web-server and judging by the searches I have done, this appears to be fairly common but I am very stuck. When someone tries to upload a photo, the error ‘The upload path does not appear to be valid’ is returned and I can’t figure out why. My suspicion is that the ‘MKDIR’ path isn’t correct relative to where the codeigniter upload function is trying to place the file. But I don’t understand why these scripts worked fine on my local host. The structure of my site is as follows and I am trying to create subfolders in the main folder ‘PHOTOS’ to upload to:- HTTPDOCS/ APPLICATION SYSTEM PHOTOS Part of my model file (functions used to generate a random string to set the file path and the subdirectory structure):- Code: class Image_file extends CI_Model { And this relates to the controller (relevant part shown only):- Code: //upload photo file Can anyone help??? I've been trawling through pages and pages of people having a similar issue, but can't seem to solve this one. Thanks. Codeigniter upload path invalid on webserver but valid on local host - El Forum - 09-23-2012 [eluser]Dandy_andy[/eluser] I seem to have resolved this permissions issue by running PHP as a CGI application and adding a quick function to check if a directory already exists or not. I think the system was failing because some directories existed. This is how I changed the controller code for anyone interested and it now works... Code: //check if image exists in directory with same string (unlikely but better safe than sorry!) |