New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Increase flexibility for HTML5 uploads #1012
Conversation
Can you describe the case when having url option as a function might be useful? |
@jayarjo I working on an upload widget for Rackspace Files. Initially, I tried to do a regular POST request to their API. However, a successful upload always replies with a redirect, and it would be a preflighted CORS request, which is not supported by design. See documentation at w3.org and MDN. The alternative is to make a PUT call to a TempURL. Plupload only supports POST call, so I had to make an option to change that. Also, the URL is different for each file. Accepting a function for the url seemed like the cleanest way to achieve that. |
BTW, I was trying to make plupload work wit flash (which could be an alternative for my case), and I couldn't. I tried to simply modify this fiddle (linked in https://github.com/jayarjo/plupload-demos) to have only |
Is this a requirement by Rackspace that each url should be different for every file? There is some problem with the version of the flash shim on github, simply try the one from the package. |
Yes, it's a requirement of the Rackspace API. The url to make the I'll try the flash from the package. BTW, if I didn't want |
mOxie has to be custom compiled to include only specified runtimes and included before |
Can you provide examples of typical Rackspace URLs? In general it should be possible to simply change |
This is a typical Rackspace TempURL:
|
Flash and Silverlight could potentially use And I'm not sure Sadly, for our case, I'm starting to feel that we'll have to build a component ourselves. |
Currently concurrent uploads are not supported. But if they were I do not see how setting url via Is |
Setting the url on Rackspace currently doesn't accept |
I'm not against such pattern in general, it's nice. It's just that it may lead to confusion in this particular case. Amazon is considering |
In my particular case, large file uploads are a common usage. Now that I know that flash loads the whole file into memoty, I guess it won't be an option. |
Thought I'd chip in that some way to have a function for an uploaded filename could be nice for me too, but if I did that the same facility would be needed for setting multipart params. I basically make an AJAX request to get a signed policy to upload a file or group of files and I was going to have to do this for each file, but decided to make a policy for some-path/* that allows uploading files with a certain prefix but doesn't limit the number of files somebody could upload with the policy (which could be a potential issue if a malicious user wanted to fill up a bucket). This is for Google Storage but I'm guessing other providers might allow wildcard prefixes too. |
@wuservices can't you do it with the approach that I described above - through |
@jayarjo, ah yes. Sorry I only saw a few messages in the thread. It sounds like that would work. The last part where you delay the upload is what I didn't know I could do before. Since getting a new policy via AJAX would be async, I'd need to go that method but yes that would address the issue. I've stuck with the wildcard prefix for now though to maximize performance with the risk of the user being able to upload a lot of files before the policy expires. |
This overlaps with #1208 which is based on more recent code (merges without conflicts) and is more idiomatic of plupload, but doesn't include content-type overriding which this has. I would add that PUT support is handy for using Amazon S3's presigned_url functionality to get temporary URLs for upload much like use case for Rackspace that this PR covers. |
method
may be specified.POST
is the default.url
to do so.application/octet-stream
.