Intel XDK Image Upload - intel-xdk

I'm trying to upload an image on Intel XDK
intel.xdk.file.uploadToServer(pictureURL,"http://www.myserver.com/uploadImage.php", "", "image/jpeg",
but the image doesn't seem to upload to the server even though i get a success from the callback, anyone have an idea what could be wrong?

there are many ways to upload file to server. at all this is a 2way action.
maybe file has been uploaded but an error has occurred in server. you can use fail callback and got the error.
, function (error) { alert(JSON.stringify(error)); });
or maybe an undefined value cause error andbreaks the next line.
using ajax calls, httpRequest are standard ways which has many references

Related

ImageResizer: System.BadImageFormatException is causing Web app crash despite being in try ... catch

A user uploaded a PNG file which looks as if it is corrupted in some way. But the biggest problem is that any time our system tries to thumbnail it the entire app pool crashes and restarts. I've tried it using a direct URL and using code inside a try ... catch block.
Here's a copy of the image: https://drive.google.com/file/d/1GpmnIbia3rtqfKrhpg_nKHpjxdC-AxR3
If I load it into Paint.NET and save it out again it works fine so I'm content there is an issue with the image. But I need to stop any corrupt images from crashing my web app entirely. I'm happy to handle and log the errors, but I need everything to continue as normal.
For instance, running locally as a test, I can view the image directly without issue. The browser doesn't mind:
http://localhost:60148/Content/artwork/2019/06/img_0021-9.png
But if I try a thumbnailed version:
http://localhost:60148/Content/artwork/2019/06/img_0021-9.png?w=160&mode=max&otf=y&quality=90&format=jpg&bgcolor=white
Visual Studio will report the following and stop debugging:
System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)'
I have some legacy code that will also write the thumbnail as a response stream. Even though that's in a try catch VS still stops debugging after reporting the error. I have local and global error handling so I wouldn't expect a crash.
try
{
ImageBuilder.Current.Build(pathname.StartsWith("/") ? "~" + pathname : pathname, outputStream,
new ResizeSettings(resizeSettings));
}
catch (Exception ex)
{
Console.WriteLine("Could not output to stream: " + ex.Message);
}
On this method I've tried adding the following attributes without any success:
[HandleProcessCorruptedStateExceptions]
and
[SecurityCritical]
I've tried putting it in its own Task in the hope it would localise it, but no joy. It's moot anyway. We use URLs for ImageResizer almost exclusively, and that's killing our web pool.
It's not just locally. It was noticed because we run this as a beta Web site and it was killing it.
System.BadImageFormatException never refers to images. It is an exception exclusively for .dll and .exe files, and refers to using the wrong bitness (like 64 vs 32) of file.
Something else is going on here. ImageResizer also is not known for killing the app pool. What plugins do you have installed? Posting the diagnostics page (/resizer.debug) would help.

File download via LWP returns error 500 (probably timeout due to long waiting time)

I'm pretty new to Perl and just tried to use a simple and small script to download a file. It works on most websites, but it seems like it is not working on the one particular website I need to download a file from.
My code is:
use LWP::Simple;
my $status = getstore("http://www.regelleistung.net/download/ABGERUFENE_MRL_BETR_SOLL-WERTE.CSV", "file.csv");
if ( is_success($status) )
{
print "file downloaded correctly\n";
}
else
{
print "error downloading file: $status\n";
}
I always keep getting error status 500. The file is directly linked on
https://www.regelleistung.net/ext/data/ where you can click on "MRL", "SRL" and "RZ_SALDO".
Also, if I try to download the file via clicking the link in my browser it takes like forever to load before the actual download starts.
I feel like I need getstore() to wait until either it timeouts (say ~60 seconds) or the file is loaded.
Do you have any hint that could help me solve this problem? Using some other library or method? Even keyworks might be helpful, since I actually don't know what I could search for on Google.
Your code ran successfully the first time I tried it. I suspect that the site may have been busy when you first tested
To make the kind of changes that you are asking about you need the full LWP::UserAgent module, but I think your code should work for you if you keep trying a few times

Downloaded ppt file seems to be corrupted

Recently I've integrated Google Drive with my iOS application. Everything works fine but .ppt files. Normally if a file is a Drive file I use downloadURL to download it. If the file belongs to Google Docs I use one of the exportLinks (exactly the same as Alain described it here).
However all .ppt files (with "mimeType": "application/vnd.google-apps.presentation") which come from Google Docs are corrupted after being downloaded (I use an export link with exportFormat=pptx). The same file downloaded via web browser works fine.
I use ASIHTTPRequest lib for downloading files (which also can be the reason of corrupted .ppt?).
Any ideas why only ppt files cause problems?
I can already tell you that the lib you're using isn't the cause:I'm not using it but I've the same problem: it seems that there the code received isn't 200 (if ($httpRequest->getResponseHttpCode() == 200)) as it shows me a specific error message I've asked to return in case of. Also, when I'm trying to download a presentation in PDF or txt, it shows the same error.
It's not really an answer but I'm trying to understand also why only presentations are causing problems.
EDIT: the code received is 302. If it can help...
EDIT 2: After trying, I noticed that the first parameter is the file id and the second the export format:
https://docs.google.com/feeds/download/presentations/Export?docId=filedid&exportFormat=pptx
But in the 302 code, I have this location:
https://docs.google.com/feeds/download/presentations/Export?exportFormat=pptx&id=fileid
Not only the two parameters aren't in the same order but the name is id and not docid
When I take this URL, put it as the export link and then try to copy the file, it's working. I get a 200 response and the inside of the file.
I hope it helps.

Uploading images to a server using an iPhone

How can I upload multiple files to a server using an iPhone, without error?
I am using HTTP for uploading images but some of images are missing.
The ASIHTTTRequest library's ASIFormDataRequest method allows you to easily attach images to your post with a simple line of code for each imag, doing the whole thing asynchronously with simple success and failure delegate methods.
Just a suggestion. Posting your code is essential if you want to use your own code instead.

Frame load interrupted error while loading a word document in UIWebView

I want to load a word document using UIWebView. I used the code provided in
http://developer.apple.com/iphone/library/qa/qa2008/qa1630.html
to load the document.
But not all the documents load successfully. Sometimes I get an error
Error Domain=WebKitErrorDomain Code=102 UserInfo=0x145bc10 "Frame load interrupted"
The error seems to be very sporadic and I get this error only for some documents.
However the same document loads correctly in mail.app.
What am I missing?
The reason was, the file I tried to load doesn't contain a extension.
I was purposely removing the file extension (.doc and .ppt) which I think confused the UIWebView. Seems like iPhone ignores the OS 9 legacy typecodes completely. :)
I submitted a Radar regarding this issue. It's resolved in the latest version of iPhone OS 4.0.
http://openradar.appspot.com/radar?id=381401