The file name you submitted already exists on the server - codeigniter

Most of the time I upload an image I get an error which says "The file name you submitted already exists on the server". I am using codeigniter version 2.1.0.
Please help regarding how can I fix this.
Thanks

Please enable encrypt_name, find more here
$config['encrypt_name'] = TRUE;
By this line you are telling codeigniter to create (pseudo) random filname for your file therefore your file is going to be unique (in name matter).
Furthermore you can create such a system that uploads files in folders, consider following folder structure:
/files/pictures/<date_of_upload>/<random_string>_big.jpg
/files/pictures/<date_of_upload>/<random_string>_thumb.jpg

Related

Code Igniter - creating folder in FTP

I need your help. I am trying to create folders on my FTP server through my Code Igniter web application. If the manager clicks attachments on projects a folder gets created if it doesn't exists yet and then through file upload he populates it with files.
I have achieved all this when running the code on localhost (the folders got created, and file upload worked too), however when I uploaded my app to a live site I couldn't create folders, so I googled a little and found out I should use the ftp library, because I couldn't create the folders with the relative paths I had.
However, I still cant seem to create the folder with the following code.
if($this->ftp->list_files('attachments/výkres'.$id) == FALSE)
{
$this->ftp->mkdir('attachments/'.$id);
}
I always get the error:
Unable to create the directory you have specified.
Hope this will help you :
use with full path with starting and ending slashes like this:
if($this->ftp->list_files('/public_html/your_path/attachments/yýkres'.$id.'/') == FALSE)
{
$this->ftp->mkdir('/public_html/your_path/attachments/'.$id.'/', DIR_WRITE_MODE);
}
for more : https://www.codeigniter.com/user_guide/libraries/ftp.html#CI_FTP::mkdir

File not downloading laravel 5.6

I've read other questions and implemented answers but haven't had any success.
Here's the error:
files in database, and locally:
here's my form:
here's my file-controller:
The flow is I upload a file, it is stored into the database, and locally, the files locally work properly. I implemented the download attribute and was able to get actual files, but those files and that process was scrapped because the files downloaded, while they had the correct names and mime types, the file had a error like "could not open file".
I am primarily using the download method in the filecontroller which you can see above, I used some ideas for getting the actual path to the file, as that seems to be the issue, but even using the storage_path method I'm getting this error.
Thanks!
I didn't understand the pathing for filestorage enough, and was therefor obviously getting the incorrect paths to the file being stored.
For example, the storage_path method returns the path to storage, I thought it was going to give me the exact path to the file. Once figuring this out I was able to navigate and fix my issues.
filecontroller
line 52: storeAs was storing to a redundant path, i made it as '/upload'/
filescontroller#download
return response()->download(storage_path("app/upload/{$file}"));
following the paths where files were being saved locally, I was able to fix this issue.

Fatal error: Class 'Mage_Sales_Model_Order' not found in ....core/Mage/Reports/Model/Resource/Order/Collection.php on line 456

I was installing magento 1.9.1 on my server everything went fine but after installation when i click on Go to Backend and give my username and password to login to Admin Panel it gives the following error:
Fatal error: Class 'Mage_Sales_Model_Order' not found in
/home2/siatel/public_html/4ebay/app/code/core/Mage/Reports/Model/Resource/Order/Collection.php
on line 456
Though my frontend side of website is working perfectly ... Please help.
I can see my admin log-in page. Error comes only when I give username and pass and hit continue...
Without more information, it sounds like you're missing your
app/code/core/Mage/Sales/Model/Order.php
file. It seems like you're missing a lot of different files as well. I'd diff your installation vs. the contents of a standard tar archive.
Your error shows like this
Fatal error: Class 'Mage_Shipping_Helper_Data' not found in
/home2/siatel/public_html/4ebay/app/Mage.php on line 547
see the portion 'Mage_Shipping_Helper_Data' not found. It means Magento is looking for a helper class file and it couldnt find it. Magento will look for this file in app/code/core/Mage/Shipping/Helper/Data.php.
I will give you some hint on how this file path came from. First of all magento core files lies in the location app/code/core/. Then missing class name (in this case Mage_Shipping_Helper_Data) will converted as Mage/Shipping/Helper/Data.php. Then this will append to the core codePool directory path. That is app/code/core/Mage/Shipping/Helper/Data.php
For every file, magento assigns path as like this. Please note that, you need to attach .php part to the last keyword. Also you need to copy the exact same data of that file (take into consider the version). It means it need to have a 'Magento way' class name and so on

openx: can't upload banner after moving to new server

I went through the whole process in order to move openx. My banners are normally displayed and I have full access to administration. The only issue is that when trying to upload a banner, it isn't saved. When returning to the banner properties tab the file is missing. Can you help please? Thanks.
This issue may raised after migrate files in to new server then you may not change "webDir" value in your configuration file under "YourOpenX/var/yourdomainame.conf.php" file .
If above mentioned not working then problem should be in "www/images" folder permission.
check and put your comment here if you need any other help.

codeigniter display error: Unable to locate the model you have specified:

I use latest version of CI, that is 2.1.2.
I upload my demo application in the following location http://www.domainname.com/myfolder/index.php
If i try to open home page, welcome controller is opened correctly. However if I try to open http://www.domainname.com/myfolder/index.php/controllername/functionname page, I get the following error message:
An Error Was Encountered
Unable to locate the model you have specified: backofficeusersmodel
In my config file, I have the following settings:
$config[‘base_url’] = ‘http://www.domainname/myfolder/’;
$config[‘index_page’] = ‘index.php’;
I also tried and
$config[‘base_url’] = ‘http://www.domainname.com/myfolder/application/’;
$config[‘index_page’] = ‘index.php’;
without any success.
However, the model is uploaded and its name is backOfficeUsersModel, not as stated in the error message all lover case.
I would like to mention that I use myModel (uploaded in application/core), and that same strange thing was happening when I upload same application under some free hosting, just there the error was that mymodel could not be located.
I upload same application on different hosting company and there it worked. Also, same application work normally on my localhost.
Anyone had similar experience?
Model files should be in application/models folder and should be named in lower case like backofficeusersmodel. Probably there is a deficiency in these requirements.

Resources