merbin2012 / sharex

Automatically exported from code.google.com/p/sharex
0 stars 1 forks source link

POST File Upload Option for Custom Text Uploaders #305

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What new or enhanced feature are you proposing?
The ability to have the text for a custom text uploader uploaded as a file
similar to images.

IE, would be available with <?php $_FILES["form"]?>

What goal would this enhancement help you achieve?
Ability to upload very large amounts of text, as I am currently exceeding URI 
length limits.

Original issue reported on code.google.com by computer...@gmail.com on 7 Feb 2013 at 5:38

GoogleCodeExporter commented 9 years ago
As a workaround you can use "Text uploader: File uploader" with "File uploader: 
Custom file uploader" so you can use post upload like this.

Original comment by flexy...@gmail.com on 7 Feb 2013 at 5:40

GoogleCodeExporter commented 9 years ago
Ah, that's a good point, although a more 'official' feature would be much 
appreciated. Using the workaround would require creating a file first, right, 
rather than taking the text from the clipboard?

Original comment by computer...@gmail.com on 7 Feb 2013 at 5:51

GoogleCodeExporter commented 9 years ago
It not creating file, it using memory stream. Because every single text 
uploader api i used works with get method, i made class according to this so i 
can't do what you want.

Original comment by flexy...@gmail.com on 7 Feb 2013 at 5:53

GoogleCodeExporter commented 9 years ago
Right, but the Text Uploader->File Uploader->Custom File Uploader route would 
require that I create a file first, no?

Original comment by computer...@gmail.com on 7 Feb 2013 at 5:59

GoogleCodeExporter commented 9 years ago
No it don't require file.

Original comment by flexy...@gmail.com on 7 Feb 2013 at 6:00

GoogleCodeExporter commented 9 years ago
Me being me, I decided to see if I could implement my request myself. Attached 
is a patch file containing the changes I have made (which can be opened in a 
text editor. The important part is at line 715; everything before is generated 
UI code change), which are:

1) When POST request method is selected and a file form name is supplied for 
custom text uploaders, the input is uploaded as a file rather than an argument 
in the URI.

2) Small UI tweaks and tooltip update - below is the rewritten text for the 
request method [?] box, I couldn't get the newlines to work.

--

For image & file uploads, the 'POST' request type is required along with the 
'File form name.'

For text & url shorteners, both request types are usable: if using the POST 
method, entering a 
File Form Name will upload the input as a file (useful for very long inputs), 
while leaving 
FileFormName blank will act like GET, where you need to use '%input' for an 
argument value.

For example, if the argument name is 'pastebin_text' then a value of %input 
will be automatically
replaced with the text you're going to upload. Same thing applies for url 
shortener; '%input' 
will be replaced with the url in the argument.

--

Hope to see at least some of this added in if you like it.

Original comment by computer...@gmail.com on 8 Feb 2013 at 6:58

Attachments:

GoogleCodeExporter commented 9 years ago
Why i can't use post in text uploader is because haven't filename to use. 
Therefore you used "text.txt" so all text uploads will have same filename which 
is not acceptable.

Original comment by flexy...@gmail.com on 8 Feb 2013 at 2:32

GoogleCodeExporter commented 9 years ago
What do you use for the name of an image? Settings->Upload->General->"Name 
Pattern for capture or clipboard upload:", right? Is there any reason to not 
use that for the text file?

Original comment by computer...@gmail.com on 8 Feb 2013 at 2:48

GoogleCodeExporter commented 9 years ago
Because it is not given to upload method.

Original comment by flexy...@gmail.com on 8 Feb 2013 at 2:50

GoogleCodeExporter commented 9 years ago
What you tried to change in designer.cs because i can only see control size 
changes and also tooltip is removed.

Original comment by flexy...@gmail.com on 8 Feb 2013 at 2:56

GoogleCodeExporter commented 9 years ago
Also stream is given to text upload method and it converting to string so after 
that again turning it to stream gonna be weird. Because that custom uploader 
can work with both string and stream and because of interface i must use only 
string parameter it gonna cause problem too. So if it was possible fix with 
clean solution i would have did it myself.

Original comment by flexy...@gmail.com on 8 Feb 2013 at 3:01

GoogleCodeExporter commented 9 years ago
Can you fix your tooltip description because im not planning to add filename 
support to url shorteners because obviously there is no file.

Original comment by flexy...@gmail.com on 8 Feb 2013 at 3:44

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r299.

Original comment by flexy...@gmail.com on 8 Feb 2013 at 3:47

GoogleCodeExporter commented 9 years ago
Can you test latest commit is text uploader works with GET, POST, POST file 
form.
Because i don't have host to test.

Original comment by flexy...@gmail.com on 8 Feb 2013 at 3:47

GoogleCodeExporter commented 9 years ago
Apologies for not replying, was in class. 

In the designer, I had added a filename pattern field on the custom uploader 
form, but removed it shortly after.

r299 works great, thanks for adding this.

Original comment by computer...@gmail.com on 8 Feb 2013 at 4:29

GoogleCodeExporter commented 9 years ago
Here's a revised tooltip text.

--

For image & file uploads: the 'POST' request type is required along with the 
'File form name.'

For text: Specifying POST request type and a File Form Name will upload the 
input as a file
(useful for very long inputs). 

For text or url shortener: POST with no File Form Name or GET will replace an 
argument with 
value %input or $input with the text or URL.

For example, if the argument name is 'pastebin_text' then a value of %input 
will be automatically
replaced with the text you're going to upload. Same thing applies for url 
shortener; '%input' 
will be replaced with the url in the argument.

--

Hope that's clear enough.

Original comment by computer...@gmail.com on 8 Feb 2013 at 4:56