Farklı dosya türleri çoğunlukla pdfs uploading

1 Cevap php

Ben şu anda bu bir komut ben Snipplr bulduğum çalışma almak için çalışıyorum ama o-cekti kabul gibi çalışmıyor belli bir dizine pressumably dosyaların pdfs farklı upload etmek istiyorum, burada benim kodudur.

Never mind I had an extra comma in my code

UPDATE: I added some more code in comments below, I want to also add the filename to a field in a datatbase, currently the script I have breaks the page nothing loads I am not sure why since it seems to work on other pages I have.

<?php
if( isset($_POST['submit']) )
    {

    $target_path = "../downloads/";
    $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); 

    if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
        echo "The file ".  basename( $_FILES['uploadedfile']['name'])." has been uploaded";

/*
        $title = basename( $_FILES['uploadedfile']['name']);
        $sql = sprintf("INSERT INTO forms (title)VALUES('%s')",
        mysql_real_escape_string($title)
        );
        $results = mysql_query($sql)or die(mysql_error());
*/
    } else{
        echo "There was an error uploading the file, please try again!";
    }

}
?>

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

1 Cevap

Apart vb mevcut dizin, dosya izinleri, gelen, sizin girişi bir isim vermek isteyebilirsiniz:

<input type="file" name="uploadedfile">