file-upload

javascript - get the filename and extension from input type=file

喜欢而已 提交于 2020-04-05 09:25:00
问题 I have a file upload input and when I click the browse button and select the file, I want the filename and extension to appear in two input text boxes (see code sample). It works correctly with the extension, but the filename also shows the path which gives me the fakepath warning. I understand why, but what's a good way to do this and just get the filename into that box. I don't need the path. function getoutput(){ outputfile.value=inputfile.value.split('.')[0]; extension.value=inputfile

javascript - get the filename and extension from input type=file

末鹿安然 提交于 2020-04-05 09:24:11
问题 I have a file upload input and when I click the browse button and select the file, I want the filename and extension to appear in two input text boxes (see code sample). It works correctly with the extension, but the filename also shows the path which gives me the fakepath warning. I understand why, but what's a good way to do this and just get the filename into that box. I don't need the path. function getoutput(){ outputfile.value=inputfile.value.split('.')[0]; extension.value=inputfile

How to upload & Save Files with Desired name

大城市里の小女人 提交于 2020-03-29 02:12:43
问题 i am using this code to upload files(images to a folder) <form action='' method='POST' enctype='multipart/form-data'> <input type='file' name='userFile'><br> <input type='submit' name='upload_btn' value='upload'> </form> <?php $target_Path = "images/"; $target_Path = $target_Path.basename( $_FILES['userFile']['name'] ); move_uploaded_file( $_FILES['userFile']['tmp_name'], $target_Path ); ?> when the file(image) is saved at the specified path... WHAT if i want to save the file with some

Need advice on Ajax fileupload

孤者浪人 提交于 2020-03-27 05:01:52
问题 I am trying get use of Ajax file uploader http://valums.com/ajax-upload/ The doc says: var uploader = new qq.FileUploader({ // pass the dom node (ex. $(selector)[0] for jQuery users) element: document.getElementById('file-uploader'), // path to server-side upload script action: '/server/upload' // WHAT IS action:? }); The element property means what element ID is used as Upload button. What is action ? It must be some sort of handler for uploaded files? How I can handle uploaded files and

Need advice on Ajax fileupload

你离开我真会死。 提交于 2020-03-27 05:01:16
问题 I am trying get use of Ajax file uploader http://valums.com/ajax-upload/ The doc says: var uploader = new qq.FileUploader({ // pass the dom node (ex. $(selector)[0] for jQuery users) element: document.getElementById('file-uploader'), // path to server-side upload script action: '/server/upload' // WHAT IS action:? }); The element property means what element ID is used as Upload button. What is action ? It must be some sort of handler for uploaded files? How I can handle uploaded files and

MIMEs, octet-stream and Uploadify

守給你的承諾、 提交于 2020-03-26 09:34:13
问题 I'm using Uploadify and Kohana and I'm creating file uploader. User can upload only few types of files. Kohana have great library of MIME types built-in. I thought that it would be cool to check that MIME type of uploaded file (it came from Uploadify) match setted file extensions. That's why I made an array of allowed MIME types. $mimes = (array) Kohana::config('mimes'); $allowed_mimes = array_merge($mimes['bmp'], $mimes['gif'], $mimes['jpg'], $mimes['jpeg'], $mimes['png']); Next, I wanted to

multiple file uploader in reactjs form

偶尔善良 提交于 2020-03-26 05:59:18
问题 I have a list of items in database and I want to render it in table and will add input type=file for each to upload file for each item on handle click i want to send item name to handle function but i couldn't, to make it clearer i want send value item.documentname to file1MadChangedHandler function, every time i click {this.props.Organizations.listDocs ? <div> { this.props.Organizations.listDocs.map(function (item, index) { return( <tr key={item.documentName}> {item.documentName} <td> <td>

Django dynamic FileField upload_to

烂漫一生 提交于 2020-03-25 18:23:14
问题 I'm trying to make dynamic upload path to FileField model. So when user uploads a file, Django stores it to my computer /media/(username)/(path_to_a_file)/(filename). E.g. /media/Michael/Homeworks/Math/Week_1/questions.pdf or /media/Ernie/Fishing/Atlantic_ocean/Good_fishing_spots.txt VIEWS @login_required def add_file(request, **kwargs): if request.method == 'POST': form = AddFile(request.POST, request.FILES) if form.is_valid(): post = form.save(commit=False) post.author = request.user post

How can I create a JavaScript condition to display either image preview of a video or image preview of a picture?

时光毁灭记忆、已成空白 提交于 2020-03-25 16:04:22
问题 On image preview, when I select a video, an empty image box is displayed on the right side of the video image preview. And when I select a picture, an empty space is displayed on the left side of the picture image preview. So both <video> tag and <img> tag are displayed together. Here is the code of the relevant HTML part, which is inside a form tag: <form method="post" enctype="multipart/form-data"> <label class="input-group-prepend" for="image_name"> <i class="fa fa-camera" data-toggle=

How to increase the upload limit for files on a Symfony 2 form?

百般思念 提交于 2020-03-14 08:43:21
问题 I have a form in Symfony where the user uploads files to. These files can be up to 50Mb in size. However, when I try to upload a file that is about 10Mb (before this, the files were no bigger than 7.2Mb) the form reloads with this error: The uploaded file was too large. Please try to upload a smaller file This is a validation error, it doesn't appear as a proper Symfony2 error. I've set the upload_max_filesize setting in the PHP.ini file to 50MB, so a 10MB file shouldn't be an issue? 回答1: You