Jump to content

uploading problem


corillo181

Recommended Posts

i got a code to upload picture i triad it to upload music but is not wokring is there a special way or music than picture?

this is the code.

[code]
<?php
$dir='../music/hmp/';
$filesize = $_FILES['sfile']['size'];
$filetype = $_FILES['sfile']['type'];
$filename = $_FILES['sfile']['name'];
$pos = strrpos($filename, '.');
$newname = $song . substr($filename, $pos);
$filepath = $dir . $newname;

$result=copy($tmpname, $filepath);
if(!$result){ echo " a problem occur";
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/29630-uploading-problem/
Share on other sites

well i dont trust my eyes any longer so it still not wokring is it something i dont see?
[code]
<?php
include_once'../includes/db.php';
//get variable

$dir='../music/hmp/';
$filesize = $_FILES['sfile']['size'];
$filetype = $_FILES['sfile']['type'];
$filename = $_FILES['sfile']['name'];
$tmpname = $_FILES['sfile']['tmp_name'];
$pos = strrpos($filename, '.');
$newname = $song . substr($filename, $pos);
$filepath = $dir . $newname;

$result=copy($tmpname, $filepath);
if(!$result){ echo " a problem occur";
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/29630-uploading-problem/#findComment-135982
Share on other sites

yes it is..

like i said.. this code i took it from one of my already working codes.. i have it as a gallery in a website..

i just never used it to upload music..i was trying to see if it works with music but is not working.

[code]
<form action="../phpscripts/muls.php" method="post" enctype="multipart/form-data" name="ulmusic" id="ulmusic">
  <table border="0">
   
    <tr>
      <td>song_name</td>
      <td><label>
        <input name="song" type="text" id="song" />
      </label></td>
    </tr>
    <tr>
      <td><label>song:</label></td>
      <td><input name="ulfile" type="file" id="ulfile" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="UpLoad" /></td>
    </tr>
  </table>
</form>
[/code]
[code]<?php
include_once'../includes/db.php';
//get variable

$dir='../music/hmp/';
$filesize = $_FILES['sfile']['size'];
$filetype = $_FILES['sfile']['type'];
$filename = $_FILES['sfile']['name'];
$tmpname = $_FILES['sfile']['tmp_name'];
$pos = strrpos($filename, '.');
$newname = $song . substr($filename, $pos);
$filepath = $dir . $newname;

$result=copy($tmpname, $filepath);
if(!$result){ echo " a problem occur";
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/29630-uploading-problem/#findComment-136015
Share on other sites

No its not...

[code]<?php
include_once'../includes/db.php';
//get variable

$dir='../music/hmp/';
$filesize = $_FILES['ulfile']['size'];
$filetype = $_FILES['ulfile']['type'];
$filename = $_FILES['ulfile']['name'];
$tmpname = $_FILES['ulfile']['tmp_name'];
$pos = strrpos($filename, '.');
$newname = $song . substr($filename, $pos);
$filepath = $dir . $newname;

$result=copy($tmpname, $filepath);
if(!$result){ echo " a problem occur";
}
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/29630-uploading-problem/#findComment-136018
Share on other sites

nah i gave you the wrong code it still the same
[code]
<form action="../phpscripts/muls.php" method="post" enctype="multipart/form-data" name="ulmusic" id="ulmusic">
  <table border="0">
   
    <tr>
      <td>song_name</td>
      <td><label>
        <input name="song" type="text" id="song" />
      </label></td>
    </tr>
    <tr>
      <td><label>song:</label></td>
      <td><input name="sfile" type="file" id="ulfile" /></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td><input type="submit" name="Submit" value="UpLoad" /></td>
    </tr>
  </table>
</form>
[/code]
[code]
<?php
include_once'../includes/db.php';
//get variable
$song=$_POST['song'];
$dir='../music/hmp/';
$filesize = $_FILES['sfile']['size'];
$filetype = $_FILES['sfile']['type'];
$filename = $_FILES['sfile']['name'];
$tmpname = $_FILES['sfile']['tmp_name'];
$pos = strrpos($filename, '.');
$newname = $song . substr($filename, $pos);
$filepath = $dir . $newname;

$result=copy($tmpname, $filepath);
if(!$result){ echo " a problem occur";
}
?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/29630-uploading-problem/#findComment-136022
Share on other sites

Hi there,

Here is a brilliant file upload script i used for my tafe project, i tested it and it can upload just about any file format you just need to get rid of the file format restrictions up top

Here is the link: [url=http://www.w3schools.com/php/php_file_upload.asp]http://www.w3schools.com/php/php_file_upload.asp[/url]
Link to comment
https://forums.phpfreaks.com/topic/29630-uploading-problem/#findComment-136029
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.