I want to attach a file to a message similar to face-book messaging.
on clicking the attach button, the browse window should open.
and on selecting the file, the file must upload and in that page it self it must show the file name.
if the user wants, it should be possible to remove that item.
please anybody help.
Google returns null.
me created a form.
<input type="submit" id="upload" value="$" style="margin-left: -10px;" onclick ="javascript:document.getElementById('file').click();" />
<form >
<input name="file" id="file" size="1" type="file" style="visibility: hidden; width: 1px;height: 1px;float: left;" onchange="this.form.submit()" />
</form>
You need to send the file upload, to a script on your server in an ajax request.
Maybe you should try a jQuery plugin which fits your needs.
Here is a nice list of uploader plugins: http://www.tutorialchip.com/jquery/9-powerful-jquery-file-upload-plugins/
PHP - File Upload on tizag.com
Related
I am trying to debug my front-end of a HTML/PHP web face and have run into an issue. Currently, the user is able to upload a file, which is then sent to a separate upload function (to process and upload their file to an AWS instance), and then redirects the user to another page.
On the page, I have two options for the user to click- the first of which unhides an option for the user to select and upload their file. This option uploads to the AWS instance and functions normally. The second option unhides some text about download/upload instructions, along with an option for the user to select and upload their file.
Both options do functionally the same thing, with only difference being the second option unhides some text in addition to revealing exactly the same button. Only the first option posts and uploads like normal; the second doesn't upload to the bucket and just returns 'zero' in plain text to the screen. Has anyone experienced anything like this and/or has any advice on how to fix it? Thanks!
Below are the two code snippets for the upload forms:
<form id="Site" method="POST" enctype="multipart/form-data">
<div id="file_input"><input id="files" type="file" name="file"/></div>
<label for="files">SELECT ZIP FILE TO UPLOAD</label>
<br>
<input type="submit" value="submit" name="submitSite">
</form>
and the one that doesn't work (exactly the same?)
<p> Download Instructions Go Here</p><br>
<form id="Site" method="POST" enctype="multipart/form-data">
<div id="file_input"><input id="files" type="file" name="file"/></div>
<label for="files">SELECT ZIP FILE TO UPLOAD</label>
<br>
<input type="submit" value="submit" name="submitSite">
</form>
And the POST function itself is:
<?php
session_start();
$_SESSION['Username'] = '';
$userID = $userID; // change this to be set in database
//set progress
$_SESSION['progress'] = 'upload_section';
'/survey_interface_shared_libraries/progress_emails/store_progress.php';
if (isset($_POST['submitSite'])) { // upload file
Please let me know if you need any further context!
Hello I needed code for automatically chose file and upload it to desired link. How to do that?
html code:
<html>
<head><title>Uploading</title></head>
<body>
<form method="post" enctype="multipart/form-data" action="uploadFile.php">
<input type="file" name="file" id="file">
<input type="submit" value="Submit">
</form>
</body>
</html>]
In above code at this line
<input type="file" name="file" id="file">
this path is fixed and can't be changed as user tries. so when user click on "Submit" button the file has to upload.
How to do this?
TL;DR: What you are trying to do is absolutely impossible - for a good reason.
If this was possible, you could create a hidden upload field pointing to a file containing valuable data (e.g. the browser's cookie database) and submit the form using JavaScript (or make the user submit it without knowing about that upload) and copy any file the user has access to.
in upload images script is it possible to show "choose file" Window automatically when open the webpage?
my input button code is:
<input type="file" size="45" name="uploadfile" id="uploadfile" class="file margin_5_0"onchange="ajaxUpload(this.form);"/>
Thank you.
I have one HTML form where I enter the Text fields and finally upload a image file into the server.
(HTML file:<input type="file" name="filename"/ >)
I use Ajax technique and HTTP POST request to perform this task.
But I'm unable to upload file but can see the text filed values in database.I'm trying to upload image file into a folder using getimagesize($_FILES['filename']['tmp_name']and move_uploaded_file() to move from temp folder to specific folder.
FirePHP is showing the warning message as :getimagesize() [function.getimagesize]: Filename cannot be empty in my .php file on line 19
line 19 contains the getimagesize() statement.
Could anybody please let me know is it possible to upload a file using ajax technique?or any other better way to do this?
Any help is greatly appreciated.
I will give you three basic ways to work on AJAX-based file uploads..
1) Faking AJAX-based file uploads - You'd create an iframe on the page (that you can hide with CSS), you can target your form to POST to that iframe.
<form target='upload_target' id="file_upload_form" method="post" enctype="multipart/form-data" action="upload.php">
<input name="file" id="file" size="27" type="file" /><br />
<input type="submit" name="action" value="Upload" /><br />
<iframe id="upload_target" name="upload_target" src="" style="width:0;height:0;border:0px solid #fff;display: none;"></iframe>
</form>
2.) FILE API: if your browser supports it, you can use the sophisticated FILE API to do what I'll call a Pure AJAX file upload - https://developer.mozilla.org/en/using_files_from_web_applications
3) You can use existing JQuery plugins such as Ajax File Upload and Multiple File Upload. Please do look up more such from the JQuery site, evaluate for cross-browser compatibility and use.
I am using nginx upload module (http://www.grid.net.ru/nginx/upload.en.html) with this plugin https://github.com/drogus/jquery-upload-progress to upload files on my server successfully with progressbar. here is my form:
<form id="upload" enctype="multipart/form-data" action="/upload/" method="post">
<input type="file" name="file_1">
<input type="submit" value="Upload">
</form>
Now i wants to use an option to download remote files with progressbar so my form is this:
<form id="download" action="/upload/" method="post">
<textarea rows="2" cols="20" name="links"></textarea>
<input type="submit" value="Upload">
</form>
So if i give a file i.e http://domain.com/file.zip in links textarea and after hit submit it should display me progressbar for downloading files.
I notice from my first upload method there is some data being generated from a link (http://domain.com/progress?X-Progress-ID=0c1ecb6da3f3ffc3848ceb337541ab1d) like this for files being uploaded but i am not sure if i can use this to show download progressbar:
new Object({ 'state' : 'uploading', 'received' : 674808, 'size' : 2028876 } )
Thank you for any help.
Best Regards
EDIT FIX
Found the solution here, https://gist.github.com/1030450 need to use curl, save the progress in file then call with ajax to get current progress...will post my solution later on :)
Found the solution here, https://gist.github.com/bdunogier/1030450 need to use curl, saved the progress in file then called with ajax to get current progress.