upload

Django file upload using Form

走远了吗. 提交于 2019-12-02 07:48:54
Hy there, my first question on this website, so sorry for my english. So i try to upload a file on a model in Django framework. class banner(models.Model): #id is made by Django name = models.CharField(max_length=255) created_by = models.CharField(max_length=255) company = models.CharField(max_length=255) register_date = models.DateField(auto_now_add=True) file = models.FileField(null=True, blank=True) file_name = models.CharField(max_length=255) this is the model class BannerForm(forms.Form): name=forms.CharField(max_length=255) created_by=forms.CharField(max_length=255) company=forms

Upload file using HTTP. getting error :- HttpSendReuest 12005

a 夏天 提交于 2019-12-02 07:31:47
I want to upload "D:\er.txt" to webserver using HTTP, when I am running program, i got HttpSendRequest 12005 as an error. i used a PHP script on my webserver that will accept the file and stores it in a pre-made directory named as "upload".. here is my tiny program int main() { static TCHAR frmdata[] = "-----------------------------7d82751e2bc0858\r\nContent-Disposition: form-data; name=\"uploadedfile\"; filename=\"D:\\er.txt\"\r\nContent-Type: text/plain\r\n\r\nfile contents here\r\n-----------------------------7d82751e2bc0858--\r\n"; static TCHAR hdrs[] = "Content-Type: multipart/form-data;

Flash image upload with mandatory crop?

梦想的初衷 提交于 2019-12-02 07:11:56
问题 Anyone know of a Flash file (image) uploader that will force a user to resize and/or crop their image BEFORE uploading it? To then upload it as well. Basically, I don't want my server processing the image resize/crop. I want to specify a target aspect ratio and have the user resize and crop their image to make it fit. I've seen cropping uploaders before but they all seem to be server side. I saw a Flex one but I'm not sure it's "mandatory" -- Basically if the user just uploads the image

Uploading .amr with codeigniter

帅比萌擦擦* 提交于 2019-12-02 07:11:47
I have been trying to get .arm upload to a website built in codeigniter. I know its not a default mine type so I added it with this: 'amr' => 'audio/amr', but its doesnt seem to be working with that. I also added it to the allowed types. Any idea if amr can be supported and if so what may I be doing wrong? Rocco You could try looking at system/libraries/Upload.php line 199: $this->_file_mime_type($_FILES[$field]); Change that line to $this->_file_mime_type($_FILES[$field]); var_dump($this->file_type); die(); Now you redo your uploading and see what the actual mime type the browser sent to your

(CURL, PHP) Uploading files with PUT request, How do I process this?

只谈情不闲聊 提交于 2019-12-02 07:09:10
问题 this is what i have in process.php parse_str(file_get_contents("php://input"),$upload_data); if (isset($upload_data)) { print_r($upload_data); exit; } this is how i query to server using curl. weldan@prindu:~$ curl -X PUT -H "X-TOKEN: test123" -F filedata=@/home/weldan/Pictures/Cool-Pictures1.jpg http://host.tld/process.php Array ( [------------------------------22031b6e799c Content-Disposition:_form-data;_name] => "filedata"; filename="Cool-Pictures1.jpg" Content-Type: image/jpeg ��� ) so

javascript/flash library for file upload with file size limit and progress bar

。_饼干妹妹 提交于 2019-12-02 06:54:42
Is there any "mainstream" library used for this purpose? Commonly spread, well maintained, documented etc. I found these (using flash): Uploadify - not many releases, latest 12/2010, no documentation (!) SWFUpload - latest release 03/2010, documentation fancyupload - looks buggy. phpfileuploader - looks heavyweight, and looks commercial (?) I cannot read the licence (you can download it but are you allowed to use it forever without paying?) plupload New version of pure javascript (no flash) Valums' ajax upload claims to handle file size limit and progress bar, which is quite suspicious to me:

Android Facebook SDK Progress Bar during upload

喜欢而已 提交于 2019-12-02 05:51:31
问题 I am trying out the FB SDK and I was wondering if it is possible to attach a progress bar while data is being uploaded. This is a sample example on how FB tells us to do. ByteArrayOutputStream bos = new ByteArrayOutputStream(); me.compress(Bitmap.CompressFormat.JPEG, 100, bos); params.putByteArray("picture", bos.toByteArray()); mAsyncRunner.request("me/photos", params, "POST", new SampleUploadListener(), null); The issue is that you are forced to use a byte array instead of an output stream

PHP File Upload Creating Directory

主宰稳场 提交于 2019-12-02 04:56:36
So I have a file upload portion on my website where the user can upload any doc or docx folder. Heres my html code: <form action="upload_file.php" method="post" enctype="multipart/form-data"> Select a file: <input type="file" name="upload"> <input type="submit"> And here's the code for upload_file.php: <?php session_start(); $allowedExts = array("doc", "docx"); $extension = end(explode(".", $_FILES["upload"]["name"])); if (($_FILES["upload"]["size"] < 200000) && in_array($extension, $allowedExts)) { if ($_FILES["upload"]["error"] > 0) { echo "Return Code: " . $_FILES["upload"]["error"] . "<br

Not able to upload in a passenger app behing apache

徘徊边缘 提交于 2019-12-02 04:31:56
Am not able to upload a 8.4 MB file, in a passenger app behind apache. Transferring the same file via scp took 4.1 minutes. Error backtrace: [ pid=10222 file=ext/apache2/Hooks.cpp:727 time=2010-05-18 07:13:14.842 ]: Unexpected error in mod_passenger: An error occurred while receiving HTTP upload data: Connection reset by peer (104) Backtrace: in 'boost::shared_ptr Hooks::receiveRequestBody(request_rec*, const char*)' (Hooks.cpp: 1084) in 'int Hooks::handleRequest(request_rec*)' (Hooks.cpp:459) NOTE:user had not cancelled or anything. He was on firefox :-) other errors seen in the logs are: [

Uploading file via html form. In PHP, $_FILES is empty

百般思念 提交于 2019-12-02 04:31:19
So I have this code: <form name="form" action="./" method="post"> <input type="file" name="newfile" id="newfile" /> </form> When I run this php script on the action page, nothing happens echo "$_FILES['newfile']['name']; print_r($_FILES); It is like the $_FILES variable is empty. Is there any way to fix this? You need to set the enctype="multipart/form-data" attribute on your form. Example 1 from php.net : <!-- The data encoding type, enctype, MUST be specified as below --> <form enctype="multipart/form-data" action="__URL__" method="POST"> <!-- MAX_FILE_SIZE must precede the file input field