upload

Get original filename google app engine

天大地大妈咪最大 提交于 2019-12-01 18:40:21
When receiving a file upload on google app engine, the example assumes you're receiving a .png. However you only konw what the type of the image is by the extension on the filename. How do you get the original filename uploaded on GAE? The filename of the file that is being uploaded can be determined by looking at the filename property of the variable that holds the file. For example, let's say that your form has a field named content : <input type="file" name="content" /> Inside your Handler, you could find the name of the file with: filename = self.request.POST["content"].filename It seems

PHP create folder if it does not exist

巧了我就是萌 提交于 2019-12-01 18:40:05
I am creating a medium size application. This application consists of a lot of products. Now these products have many images (one product can have 5 - 6 images) To try and make some sort of ordering I want to create one folder for each product this folder contains all images that is bound to the product. Now so far I have tried the following: move_uploaded_file($file, APP.'product_images/'.$product_id.'/'.$image['name']); However when I try this I get the following error: Warning (2): move_uploaded_file(/var/www/udlejnings-priser/cake/app/product_images/22/afterClick.png): failed to open

HTML File upload field style

こ雲淡風輕ζ 提交于 2019-12-01 18:12:59
I am trying to create a file upload field that has a little bit of style to it, but I seem to be having problems finding examples of this. I know part of the reason is that the field itself varies from browser to browser. Any ideas how to do this? Or is there a way to do this without using a file element of a form that can be styled? If what you mean is the text field for the file names, you can use the input[type=file] selector in the css files. For example : input[type=file] { background-color: red; } If what you mean is the file selection dialog box, I think it's browser/OS dependent and

Script function for file upload in ColdFusion 9

拜拜、爱过 提交于 2019-12-01 17:46:19
问题 Is there a a cfscript equivalent for cffile action="upload" in ColdFusion 9? Looking through the docs, there doesn't seem to be. [Update] This was added in the 9.0.1 update http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSd160b5fdf5100e8f36f73035129d9e70a92-8000.html 回答1: You can easily abstract it with a user defined function. <cffunction name="fileuploader"> <cfargument name="formfield" required="yes" hint="form field that contains the uploaded file"> <cfargument name="dest" required=

How do I HTTP post stream data from memory in Ruby?

老子叫甜甜 提交于 2019-12-01 17:39:19
I would like to upload data I generated at runtime in Ruby, something like feeding the upload from a block. All examples I found only show how to stream a file that must be on disk prior to the request but I do not want to buffer the file. What is the best solution besides rolling my own socket connection? This a pseudocode example: post_stream('127.0.0.1', '/stream/') do |body| generate_xml do |segment| body << segment end end Code that works. require 'thread' require 'net/http' require 'base64' require 'openssl' class Producer def initialize @mutex = Mutex.new @body = '' @eof = false end def

How can I “keep” the uploaded image on a form validation error?

走远了吗. 提交于 2019-12-01 16:55:55
I have a form which has a FileField among other fields. Imagine the user chooses a file, presses submit and another field triggers a ValidationError. When I get back the form, with the errors on the page, what the user chose for the file field is gone. Can I make it appear, or is this a browser thing? This is a browser thing - for security reasons, you can't prepopulate a file input, otherwise it would be easy to trick users into uploading files from their system without their explicit action. 来源: https://stackoverflow.com/questions/6199072/how-can-i-keep-the-uploaded-image-on-a-form

Backup and upload to FTP server [closed]

混江龙づ霸主 提交于 2019-12-01 15:29:13
Can anyone direct me to a script solution that makes a backup of a directory and uploads it to an ftp server? I was searching for a batch script initially but any solution would do, as long as it is open source. Thanks in advance, Jean Alex I'll be working on one soon, but WinSCP has a CLI that you can use to accomplish this: http://winscp.net/eng/docs/commandline There are plenty examples using WinSCP on stackoverflow and on other sites, like: Batch file when using WinSCP and command prompt Problem in executing the batch file in winscp You can use this url get more examples: https:/

what is wrong with this code it gives error

落爺英雄遲暮 提交于 2019-12-01 14:51:57
can anyone tell me that what is wrong with this code it returns the error of syntax error. can anyone fix it ? dos.writeBytes(twoHyphens + boundary + lineEnd); dos.writeBytes("Content-Disposition: form-data; name="uploaded_file";filename="" + fileName + """ + lineEnd);' and its second part at catch it returns error. check this one please: runOnUiThread(new Runnable() { public void run() { String msg = "File Upload Completed.\n\n See uploaded file here : \n\n" +http://www.androidexample.com/media/uploads/" +uploadFileName; messageText.setText(msg); Toast.makeText(UploadToServer.this, "File

Codeigniter : mp4 video won't upload, no error

那年仲夏 提交于 2019-12-01 14:24:26
I'm creating a form to upload video file, but I have a strange error. My form is like this: <div style="color : red;"><?php echo $error;?></div> <?php echo form_open_multipart('data_center/ajout_ressource/formulaire_video'); ?> //various input text fields... <input type="file" name="video"> <input type="submit" value="Ajouter cette ressource" /> </form>± My method to get upload is (it's inside something to check if the rest of the form is ok): $dir = './assets/video/'; $config['upload_path'] = $dir; $config['allowed_types'] = 'avi|flv|wmv|mpeg|mp3|mp4'; $config['max_size'] = '102400'; $this-

Upload image from iOS app to php — Can't quite get it right — What am I missing?

南楼画角 提交于 2019-12-01 14:00:15
Firstly, I know this question has been asked a thousand times. I'm asking again because I've tried the solutions in the other examples and they are not working for me and I don't know why. Everyone seems to have a slightly different approach. NSData *imageData = UIImagePNGRepresentation(form.image); NSURL *url = [NSURL URLWithString:@"myscript.php"]; NSMutableString *postParams = [[NSMutableString alloc] initWithFormat:@"&image=%@", imageData]]; NSData *postData = [postParams dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; NSString *postLength = [[NSString alloc]