I am using the Loopj AsyncHttpClient for Android and it works like a charm.
Now I am trying to upload three small images to my server, and I am having some problems.
It is very weird because it works perfectly if I upload 2 images, but when I try to add a third to the same request, the server response is the error 3 for file uploads:
UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded.
So when I do this:
params.put("photo1", f1);
params.put("photo2", f2);
it works...but when I add a third:
params.put("photo1", f1);
params.put("photo2", f2);
params.put("photo3", f3);
the server fails to process the request...
I have checked the files, the server side app seems to work fine (I tried sending the data with postman and it works)
Do you know why AsyncHttpClient would fail uploading 3 files but succeed uploading 2??
thanx in advance
This problem has been introduced with version 1.4.4 of this library. I did not have time to dig deeper yet, but I suspect this particular commit: https://github.com/loopj/android-async-http/commit/9f73dc722fdf8b564bf1487eef395d0b7e4ae862 to be responsible for this issue.
As a workaround, use version 1.4.3 for now. It should work fine.
I got a similar problem after update to 1.4.4. If I upload 2 images, the server will only get 1 image (if 3, will get 2). After search and testing, I know the server, my code and 1.4.3 are ok.
Today I try this:
params.put("photo1", new FileInputStream(f1));
params.put("photo2", new FileInputStream(f2));
params.put("photo3", new FileInputStream(f3));
It works.
Related
I usually don't post any question on Stack Overflow because I always find an answer to whatever problem I'm in trouble with. But here, I haven't found a clear answer so if you can help me, thanks a lot !
I'm working on a Symfony 3.4 website. I've made a script inside my controller to return a file as a BinaryFileResponse.
$response = new BinaryFileResponse($pathtofile);
$response->setContentDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $filename);
return $response;
At first, the downloading process works ok, but just at the end, an error occurs. Chrome returns a "Network error" failure and the downloaded file stays as a .crdownload instead of being rename as an .mp3 in my case. (Note : If I rename manually the file as an .mp3, it plays correctly.)
I've searched for a possible issue on the content-length property of the headers, but it seems to be sent correctly when I check the Symfony Profiler Capture here
I've found a way to bypass this error by using a stream as mentionned in the Symfony Docs, like this :
$stream = new Stream('path/to/stream');
$response = new BinaryFileResponse($stream);
My file is served by a PHP script, but it is not generated by it. Is there a way to serve it as a static file instead of a stream ?
With the stream solution, the client can't see the actual size of the file, which is not really user friendly. Also, it is really slow.
Thanks for your help !
EDIT : the first solution works on localhost, but not on prod server.
I´ve written a tool using PHPseclibs SFTP solution to uplaod various files to different target server. All targetserver are using wingFTP.
Under some conditions the upload fails without giving any debug message or error code.
I could figure out that the error (if it occures) allways occures in the following line of my code:
[...]
if(!$sftp->put($aResult[0]["targetpath"] . $sFilename, EXPORTFOLDER . "/" . $sFilename, NET_SFTP_LOCAL_FILE)){
[...]
Is there any way to see what is happening? There are no error messages or something... can I configure debug/error messages while using PHPseclib somewhere?
In about 95% of all cases the Upload is successfull and it does not only appear on one target server or for one file. Does someone have an idea where the problem could be located?
I have build a REST server and trying to make my java application communicate to it.
But I keep getting a 404 error.
When I type in the url in my browser along with the function name like:
[url]/controller/functionname/1.json
it works fine, returning me the right data.
Without the function name:
[url]/controller/1.json
I get this error:
"action 1.json not defined in controller".
I've checked my .htaccess file and routes against a previous version I had build which was working just fine. I can't figure out what the problem might be. Any suggestions?
And oh, I should mention, the earlier version that I talked about was build on windows and this one on ubuntu.
I'm trying to upload files via the API (issuu.document.upload). It worked in the past. But on new files I receive always the following response error:
{"rsp":{"_content":{"error":{"code":"999","message":"a66125aeaff42e3a893a985fdc9b659587880484 - Internal server error"}},"stat":"fail"}}
The document also does not show up in "My Publications" (http://issuu.com/home/publications)
There is no API documentation about this error code...
Problem solved (the ISSUU developers fixed it). From the ISSUU support team: "... It seems like there was some problems with our API servers, ..."
I'm using the standalone PHP-S3 class:
http://undesigned.org.za/2007/10/22/amazon-s3-php-class
I've tried all the ready made tutorials, downloaded the source, changed the corresponding variables (set my bucket, access_key, access_secret).
I'm guetting the following error whenever I try to upload any file:
Warning: S3::putObject(): [417] Unexpected HTTP status in C:\Users\Jad\Dropbox\www\test\S3.php on line 312
Note: My bucket already exists and I even allowed all the permissions to the user everyone (temporarily for it to work but it's still not working)
I had the same problem.
If you are connected through a proxy in my case it worked connection to S3 over SSL.
$s3 = new S3(S3KEY, S3SECRET, true);
So I created a new bucket in the US (the last one was in Ireland) and everything works smoothly now.
I had the same problem. I'm connected to a proxy... If I'm connected to an other network, it works :)
I've had this issue behind a squid3 proxy and the problem was resolved by the following squid configuration directive:
ignore_expect_100 on