Jump to content

Recommended Posts

I know very little about javascript.

How do I get this script to put photos in a folder?

<form name="form1" enctype="multipart/form-data" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">

  <label for="upload[]">File 1:</label>
  <input type="file" name="upload[]" size="30"><br>
  <label for="upload[]">File 2:</label>
  <input type="file" name="upload[]" size="30"><br>
  <label for="upload[]">File 3:</label>
  <input type="file" name="upload[]" size="30"><br>
  <!-- Add here more file fields if you need. -->
  
</form>

<form  name=form method="post" action="">
<input type=text name="first" size="20"> First Name<BR>
<input type=text name="last" size="20"> Last Name<BR>
<input type=text name="email" size="20"> E-Mail<BR><BR>
<input type=button value="Submit Request" onclick="verify();">




</form>

 

How do I direct the path?

Link to comment
https://forums.phpfreaks.com/topic/207362-uploadind-photos-with-javascript/
Share on other sites

Hey Dan, what are you trying to do, exactly?

 

As a general bit of advice, remember the differences between PHP and JavaScript.  PHP is a server side language.  JavaScript is client side, meaning it runs in the browser AFTER the server side code has finished processing.  The two sides can't talk to each other unless you use ajax, which I wouldn't recommend trying until you're proficient in both languages.  As such, file uploads are done with PHP.

 

I'd combine your forms, as I have a feeling you want both the files and user data to be uploaded at the same time.  Also, be sure to write some server side form validation code.  Your verify() function can be bypassed by someone simply turning off JavaScript in their browser.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.