Jump to content

Need some help


icecoolwas

Recommended Posts

Whats wrong with this uploader script? Can you please fix it? Also disable PHP Uploading thanks im new to php but i know a little from html it makes me understand it better.

 

<?php header('Content-type: application/vnd.wap.xhtml+xml'); ?>

<?php echo '<?xml version="1.0"?' . '>'; ?>

<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml">

  <head>

    <title>PSPLime Uploader Script v1.00</title>

  </head>

 

  <body>

    <h1>Data Received at the Server</h1>

    <hr/>

    <p>

 

<?php

foreach ($_POST as $key => $value){

?>

 

<b>Name-value Pair Info:</b><br/>

Field name: <?php echo $key; ?><br/>

Field value: <?php echo $value; ?><br/><br/>

 

<?php

}

 

$optionalFileName = $_POST['filename'];

 

if ($_FILES['myFile']['error'] == UPLOAD_ERR_OK){

  $fileName = $_FILES['myFile']['name'];

?>

 

<b>Uploaded File Info:</b><br/>

Content type: <?php echo $_FILES['myFile']['type']; ?><br/>

Field name: myFile<br/>

File name: <?php echo $fileName; ?><br/>

File size: <?php echo $_FILES['myFile']['size']; ?><br/><br/>

 

<?php

  /* Save the uploaded file if its size is greater than 0. */

  if ($_FILES['myFile']['size'] > 0){

    if ($optionalFileName == "")

      $fileName = basename($fileName);

    else

      $fileName = $optionalFileName;

 

    $dirName = '/uploads/';

 

    if (move_uploaded_file($_FILES['myFile']['tmp_name'], $dirName . $fileName)){

?>

 

<b>The uploaded file has been saved successfully.</b>

 

<?php

    }

    else{

?>

 

<b>An error occurred when we tried to save the uploaded file.</b>

 

<?php

    }

  }

}

?>

 

    </p>

  </body>

</html>

 

Link to comment
https://forums.phpfreaks.com/topic/125992-need-some-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.