FileReader i upload - jak przesłać

0

Witam,
od dwóch dni się męczę z prostą sprawą. Przesyłam zdjęcia i wyświetlam (zapis: data:image/jpeg,base64,j/974vd8sa89....).

I teraz nie mogę przesłać tego jako POST (za dużo tłumaczenia czemu), więc idzie po GET.

Problem polega na tym, że nie mogę też przesłać tego jako <input type="text" /> bo ciąg znaków jest za długi. Generalnie jak przy pomocy JS zapisać ten ciąg (data:image/jpeg,base64,j/974vd8sa89....) na serwerze jako zdjęcie?

1

GET nie przyjmie takiej ilości danych. Po prostu nie. MUSISZ to wysłać POSTem.

0

The limit is dependent on both the server and the client used (and if applicable, also the proxy the server or the client is using).

Most webservers have a limit of 8192 bytes (8KB), which is usually configureable somewhere in the server configuration. As to the client side matter, the HTTP 1.1 specification even warns about this, here's an extract of chapter 3.2.1:

Note: Servers ought to be cautious about depending on URI lengths above 255 bytes, because some older client or proxy implementations might not properly support these lengths.
The limit is in MSIE and Safari about 2KB, in Opera about 4KB and in Firefox about 8KB. We may thus assume that 8KB is the maximum possible length and that 2KB is a more affordable length to rely on at the server side and that 255 bytes is the safest length to assume that the entire URL will come in.

If the limit is exceeded in either the browser or the server, most will just truncate the characters outside the limit without any warning. Some servers however may send a HTTP 414 error. If you need to send large data, then better use POST instead of GET. Its limit is much higher, but more dependent on the server used than the client. Usually up to around 2GB is allowed by the average webserver. This is also configureable somewhere in the server settings. The average server will display a server-specific error/exception when the POST limit is exceeded, usually as HTTP 500 error.

Jeżeli nie masz innego wyjścia to możesz spróbować przesłać to w kilku rzutach i to skleić, ale ja wiem czy by to zadziałało oO Poza tym możesz np.PUTem spróbować.

$('#file_upload').fileUpload({
    namespace: 'file_upload_1',
    url: '/path/to/upload/handler.json',
    method: 'PUT'
});
0

Czyli jednak - brałem to pod uwagę, ale jednak wyjścia nie ma. Dzięki wielkie.

1 użytkowników online, w tym zalogowanych: 0, gości: 1