Upload blob using WL.upload - upload

Using this example I am trying to upload a file to OneDrive.
My issue is that I want to upload a Blob object, and the WL.upload method seems to only accept the Id of an <input /> element.
Thanks.

Related

Orbeon Form - save PDF and XML in local file share after submit/save

Currently I have got Orbeon to send an email to me with a PDF and an XML attachment. Is there a way to get Orbean to also save the submitted form as PDF and XML files in a local (or remote) file share somewhere for further processing?
It's not possible to save to the filesystem at the moment. But you can use the send action to send XML and or PDF to a service.

Rails s3_direct_upload without file field

My website generates a file in javascript (audio recording) and I then want it to be uploaded to Amazon S3.
I first managed to get the uploading part working by sending the generated file to my server, where it is uploaded. However I would like now to upload the file directly to S3, without going through my server.
So I started to use the s3_direct_upload gem, which works great when using a file_field. However my file is generated by the javascript and :
- The value of a file field has to be set by the user for security reasons
- I do not want the user to have to interact with the upload
I tried to play with the S3Uploader class and to directly add data, without any success for now, it seems that I do not use the correct method.
Does anyone has any idea on how to achieve S3 direct upload without a file field ?
Thanks
Never mind, I found out that the S3Uploader class used by the s3_direct_upload gem has the same methods as the jQuery-File-Upload from which it is derived.
So one can call $("#s3_uploader").fileupload('send', {files: [f]});
And the f File will be uploaded to S3 directly

Secure file upload via Grails

What are the suggested tips and tricks you have implemented in Grails to ensure the file uploaded via <input type="file" ....> in a publicly available websites are least harmful? I am thinking about using contenttype to ensure only the Word or PDF files are allowed to upload. But I am not sure how we can prevent the Word or PDF files with executable information to be uploaded? Is there any additional filtering we can use?
You can use e.g.:
<input type="file" maxlength="5242880" accept="application/pdf"/>
Inside the upload action you can use (ClamAV)to scan for viruses.
But this leads a further problem. If the uploaders renames any file to ".pdf" it can be uploaded too. Also contentType returns "application/pdf" even if the file isn't really one.
Solution:
You must read the first line of the document and check if it begins with "%PDF". If you open your PDF e.g. with Sublime Text Editor you can see it.

ace:fileEntry - changing the filename of uploaded document

in am using ace:fileEntry component to upload a pdf file. my problem i dont know how to change the filename while uploading the document. The file gets uploaded with the originalfilename.I know that if i set useOriginalFilename=false, it would have a unique name, but I want that the file uploaded in the file system should have the custom filename which i want to pass.
My xhtml code is as below
<ace:fileEntry id="file-entry" label="Attachment"
absolutePath="STR_UPLOADED_FILES"
maxFileCount="1"
maxFileCountMessage="Limited to 1 files uploaded concurrently."
fileEntryListener="#{strformbean.fileuploadListener}"
maxFileSize="6291456"
maxFileSizeMessage="Submitted file is too large.Max size allowed is 6MB"
maxTotalSize="6291456"
maxTotalSizeMessage="Total size of submitted files is too large."
required="false"
requiredMessage="The file is required to submit this form."
useOriginalFilename="true"
useSessionSubdir="false" />
You sound like as if you expected that the temporary storage location of uploaded files is usable as a permanent storage location of uploaded files and you thus don't need to touch it. This is wrong! The location where uploaded files will initially end up is really temporary in order to save server memory usage. It will be cleaned at intervals or startup/shutdown.
In the listener method, you should be obtaining the content of the uploaded file yourself as InputStream or byte[] which you should write to the permanent storage location. During this step you have all the freedom to specify your own filename.
See also this closely related question about PrimeFaces <p:fileUpload> (whose sourcecode ICEfaces has for the major part stolen copypasted redistributed) Where is the p:fileUpload uploaded file saved and how do I change it? for a detailed answer how to deal with it properly.

How do you perform a resumable upload to a google docs collection? Namely using Java and g-data library

I've got a working system to upload to the default root using resumable uploads and I've been able to make the meta data in a collection but I need to be able to do this type of upload straight to a collection or sub collection.
My main problem is the url, there's no defined example of a straight upload path to a collection?
I assumed that it would be like:
https://docs.google.com/feeds/upload/create-session/default/private/full/folder%3A[folder_id]/contents
considering that the typical upload path is similar except without the upload/create-session part?
In a folder entry, look for a link like this:
<link rel="http://schemas.google.com/g/2005#resumable-create-media"
type="application/atom+xml"
href="https://docs.google.com/feeds/upload/create-session/default/private/full"/>
The href is what you need to send to to create the file in that folder.
p.s. Have you considered using the new Drive API? It has this funcitonality and is considerably better to use.
Turns out I was originally correct and the URL I provided was correct for uploading but the function I created for generating the URL was missing out the / between feeds and upload

Resources