Permission denied after image upload - php

I've got a image upload script that works on my Apache on IIS development server, but on the Apache Lunix live server, although the images are uploaded correctly and the MySQL database is updated correctly, I can't view the images.
Viewing the HTML source, checking both the FTP files and the database values, all look OK.
But the image doesn't show, just the white box with the red cross in the corner.
If I try to copy the shortcut of the image and open it in a separate window, I get the following:
I'm not sure what to try next, it seems strange that the files/database/source look good but it just won't show!
I've tried both $HTTP_POST_FILES and $_FILES to upload the images, but both have the same result.

Change the File Permission for images you are uploading, You Apache Server doesn't have permissions to read the image file.
So usually people have Apache Server run as a particular user, which has read (may be write ) access to such content

Related

Uploading an image via IIS inherits ReportServer permission and the file appears broken

I am using a PHP based application called CiviCRM which allows us to upload images via the KCFinder image uploader. The server is a Windows 2012 RS with IIS 8. The image gets uploaded correctly and also shows in the preview. However, Once I click away from the preview the image appears broken on the page. Even going to the URL on the browser shows the image broken. I tried the same thing for PDFS and same issue. If I login to the server and check the pdf and image it shows that it is uploaded correctly and I can even click on it. I checked further and there seems to be a user group called ReportServer. I tried searching for this group but could not find it. If I change the permission of this group to write or anything else it fixes the issue. Does anyone have any ideas?inherited permissions

social.png upload viruses as images in php

I know for the fact that there is trojan or malware in php which represents itself as an image. And I also know that to filter out the file upload we use extensions such as .txt or .png.
Is there a way to scan the files manually when they are being uploaded into the server using server built-in antivirus or the server doing this kind of tasks automatically for us? ( I mean particularly in cpanel )
thanks
If you are worried about code being uploaded to your server in the form of an image, simply re-encode the image upon upload. A file containing code with an image extension will throw an error when the encoder tries to process it.

Getting a 404 on images uploaded using FTP in Magento

I have recently installed Magento and am using it for the first time. I am trying to uplaod an image to a folder as the new logo in the heading. When I upload the image using FTP the file uploads successfully but I can’t see it in the folder listing in a browser or on the website or if I visit the url for the image. I get a 404 page instead. Everything is getting cached I believe. I have turned off caching in the back end and cleaned out var/cache folder. This is a new one to me as I wouldn’t ahve thoughts ftp uploading an image would or could be cached? I can’t even change the header image on my website.
Im using the hellowired them as a starting point.
Cheers
Check the permissions on the Images and the directory it is in.
Can you verify that it is in the folder that you have uploaded it too?
Can you view it on server browsing the directories?
Finally check that you have type it correctly as Linux box's are CAPS sensitive, this could be why you can't see it also.
Looks like my host migrated my accounts to another server and I was actually updating the old hosting. Thanks for your help.

Can't open files generated by PHP app on windows

I'm having a problem when I try to open files that were generated by my CMS on my windows machine. It has an upload function that saves the file on a given location (it is on my user folder, where I'm supposed to have all the write and read permissions).
All I can see in that folder is a generic thumbnail, the ones generated by windows for each image type, PNGs and JPEGs in this case. I tried to change de image permissions and set it to the current computer user but it doesn't work. And I'm unable to move these files to another location (upload them to the server via FTP).
I wonder if there is a way to change this behavior.
One thing I noticed is that if I copy and paste those files, I can see its contents normally. I know I can do that to each of them and rename, but there are dozens of images in that folder... don't wanna do the same thing everytime I upload a new image.
Update
This is happening only to the images that were moved (I'm using php's move_uploaded_file function, btw), not to the ones that where generated (croped, resized and so on).
It`s happening because Windows keep file permissions of TEMP folder (usually c:/windows/temp) when moving a file.
To prevent it you need to change "upload_tmp_dir" in "php.ini" to your server directory or set wide permissions to your windows temp folder.
You probably have an error in some php file which is preventing the image from being displayed correctly.
What i would do in order to detect the problem is to comment out the header() calls in the php file responsible for displaying the image and see if there is any output other than the image data.
Inspect the whole output, it only takes a character to break everything, so check if there are no blank lines at the top or bottom of the output. And in case you have an error log, consult that, it will help you trace the problem quickly.
When i have this problem, it's usually a notice or a warning showing up during the process of the image generation, and if you haven't disabled errors from being output to the screen, the notice text will be considered as part of the image data which makes the browser unable to interpret your image.
If you'd like i can take a look closely for you but i would need to see what you are doing in that php file to be able to tell you for sure.

cck imagefield upload problem?

I have a cck field of type "file". I used this for uploading of images. On my local server running on apache, uploading of image using the field is fine. But on the deployed version or the web server, the upload won't work. On the web server, I can select an image and when I hit upload, it will then display the image but when I click on save the image is gone.
Any help is greatly appreciated.
Best regards,
Check the permissions of the sites/default/files directory of your Drupal site (or the directory you've set for file uploads if you changed it). If it's not writeable, Drupal won't be able to save your file on the server.

Categories