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.
Related
I have a file upload on my page like below:
<input type="file" id="myFile" name="myFile" accept=".xls, .xlsx"/>
When open file dialog is opened, the option is like this
What I want is like this. This is an example from Ms. Excel program, and I want the open dialog file selection to be like this or at least similar to this
How can I achieve that?
Thank you.
i think gives you all custom file options
<input type="file" id="myFile" name="myFile" accept="application/*"/>
I have an HTML form which has image upload functionality, some times I need to hide it from the input of config.ini file so I had built it like this
<label class="<?php if($config[imageUpload][Status]){echo 'form-group';}else{echo 'form-group hidden';} ?>">
<input type="file" name="pictures" accept="image/*" required id="uploadImage"/>
If the status is true everything is working perfectly and if the status is false the image upload section is hiding but I could not able to submit (submit button is not working ) but when I try to comment file submit button is working
<input type=<!--"file" --> name="pictures" accept="image/*" required id="uploadImage"/>
Then I try to change type = file by writing a small php script
<input type="<?php if($config[imageUpload][Status]){echo 'file';}else{echo '<!-- file -->';}?>" name="pictures" accept="image/*" required id="uploadImage"/>
but this is not working. I would like to know why type = file is preventing me to submit? and Is there any other way to prevent this issue?
Your file input is required.
If you hide it with CSS, then it is still going to be required, the user just can't see it (but Chrome will, IIRC, warn you about this on the Developer Tools Console).
You need to remove the required attribute when you hide it.
but when I try to comment file submit button is working
Your comment syntax doesn't do what you want it to do.
First, you have an input element with an invalid type attribute:
<input type=<!--"file" -->
Then you have the rest as plain text which would be displayed to the user if you weren't hiding it with CSS.
name="pictures" accept="image/*" required id="uploadImage"/>
See how it renders:
<input type=<!--"file" --> name="pictures" accept="image/*" required id="uploadImage"/>
It appears to fix your immediate problem because the input element no longer has a required attribute (because that is part of the plain text.
You just need to change condition on file input :
<input type="<?php if($config[imageUpload][Status]){echo 'file';}else{echo '<!-- file -->';}?>" name="pictures" accept="image/*" <?php if($config[imageUpload][Status]){ echo 'required' ;}?> id="uploadImage"/>
And it works!!!
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.
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
I have used a input file code to upload image to my wallpaper site..
<input type="file" name="img" id="img" />
Is there anyway to select a image without selecting image file..like entering URL to text box?
<input name="img" type="text" id="img" value="http://www.somesite.com/image.my.jpg" size="40" />
I tried its not working...please help me! Anyway to enter image url to text box except select browse button and selecting image file? help me i tries in different ways...
Is there anyway to user type="text" excepts type="file" so We can enter image url in that text box and upload?
With that <input> you then have to tell your PHP code to go and download that file e.g.
<?php
if (!empty($_POST['img'])) {
file_put_contents('savedImage',file_get_contents($_POST['img']));
}
However doing so opens you up to some potential security issues, so be careful!
I think what you want to do is upload an image and then display that on a page.
You need to move the image into a folder on your webserver then display that output.
More info about it here.