Support » Plugins » [HELP] Upload image to a DIR and also onto a Database!

  • _OMEGA_


    Hi all, I’d like to know if it’s possible to create a form using PHP to upload an image in an own directory and store it into the database too.
    I’m looking around for some code to understand how to do it, and write it into my plugin.
    I found this:

    $uploaddir = '/var/www/uploads/';
    $uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
    if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
        echo "File is valid, and was successfully uploaded.\n";
    } else {
        echo "Possible file upload attack!\n";
    echo 'Here is some more debugging info:';

    But this doesn’t work in WP (maybe it’s my fault), anyone can help me please? :'(

  • The topic ‘[HELP] Upload image to a DIR and also onto a Database!’ is closed to new replies.