A few questions on programming sharing

The question was asked: 6 years 9 months ago   views: 5
0

Program file sharingto restore the gaps in knowledge and to learn new things.

Gentlemen, again, a lot of questions:

  1. How to force user not to see and download a picture, text, when clicking on a link? As is done in gugliotta, for example.
  2. Never found a way to check file size before uploading to the server specified using hypertext markup language input file (form). Method recognized by the decision in the past my question, it turns out, works not in all browsers.
  3. How to add a variable value to the clipboard using javascript or jquery? Is it possible?
  4. Is there a way to scale the process of uploading the file to the server using javascript, jquery? Or just flash and similar technologies, like Silverlight?

Want You are not ready code, and manuals, solutions and suggestions on what to Google, to read. Thank you.

Asked: angry angry 21-06-2012 в 22:59:07
Became interested if there's fools to you to answer?.... - Gorets Gorets 21-06-2012 в 23:02:05
answer to the first question only :) send the appropriate header via header() - johniek_comp johniek_comp 21-06-2012 в 23:48:08
> Method recognized by the decision in the past my question, it turns out, works not in all browsers. Only in IE below version 10 don't work. But agree, it is much better than no checking. - Ilya Pirogov Ilya Pirogov 22-06-2012 в 16:58:39

Answers   4

0

@Mauntain, what's the matter?!

1)

header('Content-Disposition: attachment; filename="filename"');

2)

No way. The universal methods are not, and those that can help easily fooled. Restrictions are put on the server, so keep extra 10-20, the maximum amount that you can manage to fill during the interaction with the server. Example: request time maxtime - maximum speed at the entrance to 100Mbit/s. Summary: you've got to be free ~8-15 gig.

3)

Cookies. Clipboard, fortunately, JS is not able to work (ActiveX does not count).

4)

Universal means no. Some browsers can do that, like Fox, but not all.

Answered: @Gorets @Gorets 22-06-2012 в 16:39:58
> keep extra 10-20, the maximum amount that you can manage to fill during the interaction with the server, Why? client_max_body_size - when you try to send a file larger than this value, nginx will simply terminate the connection. At all desire no gigabytes upload will fail. - Ilya Pirogov Ilya Pirogov 22-06-2012 в 17:01:40
Yeah. But note that 1) many Customers.(This is being done the reserve. To desire for all the uploaders at the same time customers are not scored drive). 2) nginx is also on the server side 3) ...he was not at all configured - knes knes 22-06-2012 в 17:16:09
3) is somehow crutches using flash. But anyway, somewhere I saw a add in a buffer, cross-browser, although on crutches - Sh4dow Sh4dow 22-06-2012 в 19:58:21
0

Immediately clicked on "send to server" and nothing was chosen

Files of this type prohibited upload, squeeze it in .rar or .zip archive.

And then closed the page.

Answered: artem artem 22-06-2012 в 16:47:56
Renamed the exe to zip. Loaded. Trollface - knes knes 22-06-2012 в 16:50:29
Yeah not so good there exe are loaded. but the fact that php I have renamed the zip and now creep on the server is cool! Holes close up in your sharing. - artem artem 22-06-2012 в 16:58:35
php I renamed. zip// I didn't want to write this, so as not to compromise. >.< - knes knes 22-06-2012 в 17:17:31
What to do now! ^_^ You need to check everything, and not to show those who sometimes "suffer renaming files," and finds an interesting hole. - artem artem 22-06-2012 в 17:20:12
@Shrek, and explain to the person the dark (to me) >but the fact that php I have renamed the zip and now creep on the server How can it happen ? He somehow allows you to go directly (GET, POST) to the flooded files ? Or I nonsense said the matter is in something else ? - avp avp 22-06-2012 в 17:44:11
0

Well the first "problem" can be solved much more flexible with magic .htaccess:

 AddType application/octet-stream .rar .doc .mov .avi .pdf .xls .mp4

As you know, this is the list of files that will be offered to save and not open in browser. But you will not need to send the headers.

Fourth, you can decide on HTML5 progress'ohms.

Answered: Free_man Free_man 22-06-2012 в 20:27:08
Super. This pregnant in five minutes from DIVS to collect. One problem: Even if I manage every second requests to a server to know the size of the already downloaded content(value), I don'T know max. So the thing is pretty useless in light of the question. - knes knes 25-06-2012 в 12:11:35
0

Regarding the fourth question - http://php.net/manual/en/session.upload-progress.php

Answered: Arseniy Arseniy 25-06-2012 в 13:59:02