0 filesize when using move_uploaded_file() - file-upload

Permissions are in line (777, owned by NGINX, etc),
Folder is writable,
File is small,
Everything I've found on Google for the last 4 hours is correct / NA
Players are NGINX, PHP-FPM, FastCGI..
I upload the file, use move_uploaded_file to move to uploads directory and the file saves. However the file, upon inspection, is 0kb and 0px by 0px. EMPTY.
Not finding this issue anywhere online?
Any thoughts?

If anyone comes across this and everything seems to be perfect.. CHECK your disk space! In my case I was using a mounted drive so I didn't get any typical low-space errors.
move_uploaded_file and copy do NOT display space issues. I had to use rename() to get any useful details.
Hope this helps some poor soul.

Someone posted a similar issue as yours here - http://bytes.com/topic/php/answers/1002-move_uploaded_file-corrupts-some-files
It seems the issue resides in transferring a GIF from a Windows machine to Linux.

Try using copy function instead. copy([source]),[destination]. If this works, that means you have a permission issue with upload temp directory.
Have you checked the permission on upload temp directory? You can find the directive/path on php.ini file(upload_tmp_dir).

Related

Responsive Filemanager doesn't upload files bigger than ~2MB

I use Responsive Filemanager for several websites that I host. I have the latest version (9.6.6) installed, and I also use the tinyMCE plugin for the Jquery tinyMCE version 4, but my problem occurs with both the standalone filemanager as well as the plugin, so I doubt this is important.
Anyhow, my problem is the following: everything seems to be working just fine when I upload files smaller than exactly 2 megabytes. Using a dummy file generator, I have been able to generate a PFD file of exactly 2097152 bytes, which uploads fine, and a PDF file of 2097153 bytes, which doesn't upload.
Responsive Filemanager always says the upload went fine (with both the Standard Uploader and the JAVA uploader), but any file bigger than 2097152 bytes doesn't actually get uploaded.
Here's a video demonstrating precicely what the problem is: https://youtu.be/NDtZHS6FYvg
Since my RF config allows files up to 100MB (see entire config here: http://pastebin.com/H9fvh1Pg), I'm guessing it might be something with my server settings? I'm using XAMPP for Windows. Could it be that there are some settings in my Apache config or something like that, which block uploads through http bigger than 2MB?
Thank you for your help!
EDIT: typo's and added links + video showing the problem.
I managed to find the solution for my own problem. I couldn't believe some sort of bug would cause any file exactly bigger than 2 MB to fail, so after a while I finally figured out it had to be something with the server itself, and indeed, in the php.ini I found the following line:
upload_max_filesize = 2M
Changing this to a bigger number fixed the problem for me. Would be nice if ResponsiveFileManager had a way of informing the user about the fact that the upload did in fact not complete successfully due to a php.ini server setting, but ah well...
You just need to change the config file of responsivefilemanager, i.e config.php
'MaxSizeUpload' => 10,
Just change the MaxSizeUpload variable and check.

Blank, broken manifest file Windows Server 2008

I have an issue with an instance of Windows Server 2008 where Server Manager will not open, nor will powershell or anything else really. I've researched solutions and attempted a dozen or so fixes including replacing the machine.config with a known good in .NET/Framework/etcetc, running System Update readiness to repair corrupt files, DISM, the works. I believe the problem stems from a specific manifest file. Remote event log viewing shows dozens of SideBySide errors pointing to this manifest file claiming invalid XML, and upon closer inspection it looks like the thing is just straight up whitespace. I have a copy of the same manifest from a known good server configuration so I'm thinking of replacing it.
First: is this a dumb idea? Is there something I don't know that's going to blow up in my face?
Second: I can't seem to replace the manifest file. Permissions are against me. Upon closer inspection it seems TrustedInstaller is the only account to have write access and above on that folder, and those permissions are locked from me even though I'm running as Administrator with elevated access. I'm guessing this is to prevent me from shooting myself in the foot, but I neeeeeeeeed this to work. So second question: how do I elevate my permissions to access the manifests folder in C:\Windows\WinSxs\?
Thank you for your time in reading this far. I greatly appreciate your collective knowledge and assistance.
Nevermind, got it. I took ownership of the specific manifest file, opened it in notepad with elevated permissions, replaced the contents with the contents of the known good config, saved it. Voila, it works just fine. Restored SYSTEM permissions afterwards to clean up after myself.

Access error uploading file using winsp

I am trying to upload two files to a webserver so my teacher can see it. I am using winsp since my filezila doesnt work. But for some reason it is telling me that i don't have access to that page. Can anyone tell me why is it doing that.Here is a picture of my screen.
I am just not understanding why it is telling me that i don't have to access it.
If I had to take a guess, that public_html folder is your public directory where you should put things that anybody can get to (like through a browser). You have your files outside of that directory, so your page can't access them.
edit:
It's an educated guess, as I have seen a fair amount of server configurations that name the public web folder as such (other common names are "www" and "httpdocs")
Problem definitly isn't in code. There is error while uploading files. Can you connect to FTP regulary? If you can. Look for Active or Passive file transfer to FTP. Also if you can upload files, files must be in public_html folder to be visible from browser.
Active or passive
First read Neal comment.
second, you should probably copy the files into the /public_html folder, instead of the / (root) folder.

Can't read or write to directory CFFILE despite 777 permissions coldfusion

This is installed on a Unix system I don't have direct access to, but can get insight on by sitting with a network team.
The problem is this, I have 3 folders I need access to, read and write. The problem is, I only have access to 1 of them, and only read. This is via ColdFusion, I can get into them fine with the user they are assigned to (and the CF server runs on, which is the "www" user).
I CAN read and write to the temporary file directory, the place files are stored before they are moved to the destination directory (SERVER-INF/ etc etc etc), but that's not helpful. I have tried having the network people set the permissions for the other folders to the same thing, but with no results. The current settings of the folder I can access are rwxrws--- and the other folders are rwxrwxr-x, so I should have more permissions ( the "s" is not a mistake in the first folder).
We have tried setting the other folders to 777 and we did not even get read capability. Does the server need to be restarted on a Unix box after setting new permissions for ColdFusion to be able to get to them? I'm out of ideas right now, I'll take any new suggestions.
TL;DR
All using ColdFusion
temp directory - can read and write to
folder 1 - can read from (including subdirectories)
folder 2 - cannot read or write to (permission denied)
folder 3 - cannot read or write to (permission denied)
Goal: Get upload functionality working.
Edit: Server using apache
Just a random guess... Have you checked that paths you are trying to access are fully correct? They should be absolute for file operations, and www user must have X permissions on the all path directories -- to enter them.
The problem ended up being a restart was required after setting the new folder permissions. We didn't think this was an issue on a Unix box, however ColdFusion apparently did. This worked.

Updating Files on Apache

I'm having trouble with my Apache Web Server. I have a folder (htdocs\images) where I have a number of images already in place. I can browse them and see them on my web server (and access them via HTML). I added a new image in there today, and went to browse to it, and it can't be found. I double and triple checked the path and everything. I even restarted Apache and that didn't seem to help.
I'm really confused as to what's going on here. Anybody have any suggestions?
Thank you.
Edit I just turned on the ability for the images directory to be listed, browsed to it (http://127.0.0.1/images/) and I was able to see all the previous images that were in the folder, but not the new one.
Turn directory indexes on for htdocs\images, remove (or move out of the way) any index.* files, and point your browser at http://yoursite/images/
That should give you a full listing of files in that directory. If the file you're looking for isn't there, then Apache is looking at a different directory than you think it is. You'll have to search your httpd.conf for clues -- DocumentRoot, Alias, AliasMatch, Redirect, RedirectMatch, RewriteRule -- there are probably dozens of apache directives that could be causing the web server to get its documents from somewhere other than where you think it's looking.
make sure the caSE and spelling are 100% correct.
There is not magic in programming (some may disagree:), so look for silly errors. Wrong server? Case of your letters? Wrong extension?
There's a chance it could be due to the cookies stored on your device. I would delete all cookies to the website you're working on before you refresh again