I've been working with the filepicker api for the past day or so - trying to wrap my head around mimetype validation when using the pick method. I'd like to only support uploading epub files, which have the mimetype : 'application/epub+zip'. However, whenever I use this as the only supported mimetype in filepicker, I get the following error :
The page can only support a application/epub zip/*
It seems to be interpreting the '+' inside of the string as a space. Any advice on how to fix this, or validate epub files properly would be appreciated!
Edit : I found a way around this by using 'extension' instead - and adding {extension : '.epub'}. This will work, as I can just set the maxSize to be some reasonable number, and perform some validation server-side (and deleting the file from s3 if it isn't actually an epub). If someone figures out how to do it properly with the mimetype that would be awesome though!
Glad you got it to work with extension, one way with mimetype might be to urlencode the + to be %2B
Related
I'm trying to embed a GIF in a GitHub Pages page and tried every single way I found online can work. Here's my link:
https://github.com/jellyfishrui/Interactive-Programming-in-Python-Rice-University/blob/master/Week3/Stopwatch-the-Game/Instructions
The last line of code is the embedding code:
![StopWatch](https://github.com/jellyfishrui/Interactive-Programming-in-Python-Rice-University/blob/master/Week3/Stopwatch-the-Game/StopWatch.gif)
I also tried to embed the PNG (also saved as other formats like JPEG) and changed the extension to upper/lower case. But none of them can help me load the image. I also tried it on different browsers but they just all turned the same.
I tried the absolute/relative path and neither worked.
That file has no file extension but you're trying to use Markdown for the image. Try renaming it to Instructions.md.
Also, make sure the casing of the file matches the file you've uploaded. Guessing what case to use isn't likely to work.
We are writing some program to display documents on iOS. I think that there are a lot of confusion on the web about what type of documents which iOS UIWebView could display. Generally people refer to Technical Q&A QA1630 Using UIWebView to display select document types to see that all the MS office 07+ files (such as docx, xlsx, pptx) could not be displayed, however actually that is not what we see from testing. Actually we are able to display docx/xlsx/pptx document at UIWebView either loading from a remote URL, local file or in memory (loadData, here the baseURL can not be nil on simulator, see this link). Of course We are testing on latest version of iOS on iPhone simulator, it might be that the support was not at older iOS. At this point, We don't know that yet. If you know, please let me know.
However right now, We have one issue to display document at UIWebView by using custom URL for security reason. I did the custom URL by following the code here: protecting iOS resource. We could display xls, doc, ppt, pdf file, but not docx/xlsx/pptx, We got some error like this:
EXCEPTION SFUZipEndOfCentralDirectoryError: Could not find the end of central directory record
We tried to debug and could not figure what's to do here. Do you see similar error here? Could anyone shed some lights on this? Thanks very much.
It looks like the document you're trying to open might be corrupt. docx, xlsx, and pptx files are actually zip files containing a bunch of XML documents and other data. Check if you are able to uncompress the file on your computer by renaming it to .zip and then unzipping.
Here i have stucked in simple concept.How to get the file-path when uploading the file in GWT. For example-(d:/example.xls) this is my upload-file. how to get this path programmatically? i have tried this
FileUpload ff=New FileUpload();
ff.getFileName();
when i use above code.it is returning only example.xls only.. help me
You can't access this information from GWT (and javascript in general)
I think, you cannot get the absolute path of a file that you have uploaded. The path will be absent or changed to avoid security risks, after you have done the upload.
You can get the file's name using the getFileName() function,
and even its content, with the HTML5 FileAPI.
i load the url and i need to run different functions for different url type; if it is pdf, image or html page. Does anyone know how i can realize this from url string.
I used to use pathExtension before but it will not always work since some html page does not have any extension.
thanks in advance
Unless you ask the server (ie make the request and get the MIME type back), then you aren't going to be able to know unless you have control of the server and you make sure that all the URLs adhere to a given standard. But I'm assuming that you are talking about URLs across the Internet on any server in which case you have no way of knowing. Also remember that some URLs may not return what they suggest. So, a PHP might actually return a PDF or an image.
This doesn't load my HTML string in the WebView.
NSString *htmlString = #"<html><body><h1>My First Heading</h1><p>My first paragraph.</p></body></html>";
//I have a very large HTML content here.. For sample I have given a small content
[teaserWebView loadHTMLString:htmlString baseURL:nil];
Do I need to use some encoding? Any help will be appreciated.
Thanks
Edit: Solution found in comments on question.
In your large HTML, Replace % with %25.
I really don't know if that will help, but it is required in Android WebView. All encoding is automatic except it does not know whether or not to encode %.
There is a better way to encode everything, but it is not required and I have no clue how to do it in iPhone.
See this page for more info: http://www.w3schools.com/TAGS/ref_urlencode.asp
Also you may want to look up "URL Encode iPhone".
I know this is not a URL, but in Android it gets converted to a data: URL where all the data is in the URL. It likely works the same way in iPhone.