First off, I have no experience with PHP. I'm setting up a form on a site that is hosted on Dotster using their link. This works to send an email with all of the info, but the file that is selected for upload disappears. Does not end up on the server, does not attach to the email. Are there any ways to determine or control where the file goes using their script?
<form method="post" action="https://www1.dotster.com/scripts/formemail.html" enctype="multipart/form-data">
<input type="hidden" name="my_email" value="flyboyjr#gmail.com">
<input type="hidden" name="subject" value="Nomination Form">
<h1>Nominee Information</h1>
<label for="photo">Please upload a photo of the nominee in uniform or sports attire appropriate with
their
nomination. Please make sure it includes a clear view of their face.</label><br><br>
<input type="file" id="photo" name="photo" required>
Related
I have a form which asks for users details and also asks for them to upload a picture by dragging an image onto a div. How can I set the upload location of the file upload? I can only find ways that upload the image straight away but I need to process it with the rest of the info in the form?
Below is a simplified version of what I have so far.
<form action="/create" method="post" accept-charset="utf-8" id="create_form" enctype="multipart/form-data">
<div class="form-group">
<textarea class="form-control page-title tooltip_target" data-original-title=
"What is your name"
data-toggle="tooltip" placeholder="What is your name" id="title" name="title" type=
"text" value=""></textarea>
</div>
<div id="upload_div"></div>
<input name="userfile" size="20" type="file">
<input class="btn btn-primary" id="profile_submit"
name="profile_submit" type="submit" value=
"Publish">
</form>
You'll have to do it with the file that processes the request. Can you show what that file looks like?
Here's an example of how to do it with jQuery and AJAX
How can I upload files asynchronously?
I have a chat and i would want to send files also during chat. I would want the same approach like facebook has: when you put the file it should not put into the specific textbox that comes with input=file and to not have the browse button? is this doable?
<form method="POST" name="form1" action="" id="myForm" enctype="multipart/form-data">
<input name="message" type="text" id="textb" value="" />
<input name="submit" type="submit" value="Chat" id="post_button"/>
<input type="file" name="fisier">
</form>
That's done with a combination of CSS and javascript.
Take a look at: http://www.dropzonejs.com/
The PHP documentation doesn't explain what happens when there are two files being uploaded at the same time within the same session (two uploads running in two tabs of a browser).
Is there any way to track the progress of both uploads?
Is the first upload status lost when the second one starts?
Thanks!
Yes, it is possible to monitor the status on two different uploads in different tabs using PHP's Session Upload Progress feature. All you need to do is make the upload progress name different on both forms by changing the value="" parameter of the hidden upload progress name field.
For example, the upload form for tab 1 could look as follows:
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="tab1">
<!-- notice the value="tab1" above -->
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="file" name="myUploadName" />
<input type="submit" />
</form>
Then, the upload form for tab 2 could look as follows:
<form action="upload.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="<?php echo ini_get("session.upload_progress.name"); ?>" value="tab2">
<!-- notice the value="tab2" above -->
<input type="hidden" name="MAX_FILE_SIZE" value="1000000">
<input type="file" name="myUploadName" />
<input type="submit" />
</form>
Now that you have created two different upload progress sessions, you can get the progress data on the PHP side as follows:
$_SESSION['upload_progress_tab1'] // Progress data for tab 1
$_SESSION['upload_progress_tab2'] // Progress data for tab 2
This example could work for you:
http://www.johnboy.com/php-upload-progress-bar/
You need some client (JS) code and a bit of PHP
I'm working a small management application and it requires us to to be able to upload images that are being trademarked, but in short I'm having problems retrieving the data to process it, after some debugging I've figure out that the form isn't passing any data to the $_FILES superglobal, and I can't figure out why.
This is the relevant form code:
<form
action="/contracts/entity/save_entity/trademark"
method="post"
enctype="multipart/form-data"
id="manage-entity-form"
>
<input
type="hidden"
id="MAX_FILE_SIZE"
name="MAX_FILE_SIZE"
value="102400000"
/>
<label for="file" class="">
<span class="ui-button-text">Image</span>
</label>
<input
type="file"
id="file"
class="ui-state-active"
name="data[Upload][]"
/>
</form>
The multipart/form-data encoding does not support multidimensional arrays - see this thread: How to upload files (multipart/form-data) with multidimensional POSTFIELDS using PHP and CURL?
I have a page with "File" html input field and a "Submit" button as below:
<form id="formUploadfile" name="formUploadfile" method="post" action="" class="form" enctype="multipart/form-data">
<label for="name"><strong>File</strong></label>
<input type="file" name="uploaded_file" size="35" />
<button type="submit" class="btn_common" id="inquiry_submit" name="inquiry_submit">
Submit
</button>
</form>
I want to send the selected file to a pre-defined email address. In PHP, Do I need to upload the file to my server first before sending it as an attachment email? Or without uploading it to server, it will work.
I Googled but didn't find the answer of above question, please help. If anyone have a code for the same purpose, please provide link.
Thanks
Yes, you will need to upload the file to the server first.
Use a mailing class like Swiftmailer to send the file.