web hosting – Why doesn’t my HTML PHP file upload form work on my website?

I have an HTML PHP website hosted on SiteGround, which I read somewhere uses UNIX servers. I created a file upload form for a job application webpage and I’ve tried every code example that I found online (that works for them but obviously not for me).

I even changed the folder and file permissions. Yet I still cannot manage to upload a simple PNG image file in testing. The tutorials and examples that I’ve found online are somewhat outdated.

Here is the code for the form.html file:

<!DOCTYPE html>
<html>
<body>
<form enctype="multipart/form-data" action="upload.php" method="post">
<p>Upload your file:</p>
<input type="file" name="uploaded_file">
<input type="submit" value="Upload">
</form>
</body>
</html>

Here is the code for the upload.php file:

<?php
$target_dir = "uploads/";
$target_file = $target_dir . basename($_FILES('uploaded_file')('name'));
if(move_uploaded_file($_FILES('uploaded_file')('tmp_name'),$path)){
    echo "The file ".  basename($_FILES('uploaded_file')('name')). " has been uploaded";
}
else{
    echo "Your file was unable to upload. Please try again.";
$uploadOk = 0;
}
?>

I do have a folder named “uploads” in the same directory on the server.

Como posso fazer Upload de um arquivo usando Selenium/Python?

Estou fazendo um Script simples de passar um arquivo para o site converter para PDF e baixar o arquivo PDF.

Estou tentando fazer upload de um arquivo usando Selenium/Python, pensei em algumas formas de fazer upload:


  1. Procurei nas documentacoes do Selenium e achei isto aqui no 8.5
    :

Select the <input type="file"> element and call the send_keys() method passing the file path…

mas o site que estou tentando fazer upload de arquivo usa o tag <a> em vez de <input>:

<a class="uploader__btn tooltip--left active" id="pickfiles" href="javascript:;" title="Adicionar mais ficheiros" style="position: relative; z-index: 1;" data-title="Adicionar mais ficheiros">

  1. Clicando no Botao de Upload

Fiz esse codigo aqui:

from selenium.webdriver import Chrome
from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.support.ui import WebDriverWait

driver = Chrome()

driver.get('https://www.ilovepdf.com/pt/jpg_para_pdf')

def espera(driver):
    return driver.find_element_by_id('pickfiles')

WebDriverWait(driver, timeout=5).until(espera)

upload = driver.find_element_by_id('pickfiles')

ActionChains(driver).click(upload).perform()

driver.quit()

Mas preciso selecionar manualmente alem dele fechar logo em seguida e nao ter tempo de selecionar o arquivo


3.Arrastar o arquivo ate o site

Estou procurando como fazer isso mas ainda nao tenho menor ideia de como fazer


Site: https://www.ilovepdf.com/pt/jpg_para_pdf

Objetivo: Automatizar a tarefa de converter PNG para PDF

Estou usando Python e Biblioteca do Selenium

custom post types – How to upload two input files

i’m doing a front end post submission for a CPT called “empresas” and with CMB2 i create a custom field called portfolio which type is file_list so the business can upload their work

In my custom form i have a input single file to upload the company logo and other input file multiple for upload their work

I’m using the following code to upload the logo as a featured image for post and works without any problem

if($_FILES) {
        foreach( $_FILES as $file => $array ) {
            if($_FILES($file)('error') !== UPLOAD_ERR_OK){
                return "upload error : " . $_FILES($file)('error');
            }
            $attach_id = media_handle_upload( $file, $post_id );
            var_dump($attach_id);
        }
    }
    if($attach_id > 0) {
        update_post_meta( $post_id,'_thumbnail_id', $attach_id );
    }

The problem is when i add the input multiple file and the code, it dosen’t upload any image, i tried this code doing a little modification but isn’t working

The code for upload the multiple file is

$otherfiles = $_FILES('trabajos_empresa');
foreach ( $otherfiles('name') as $key => $value ) {
        if ( $otherfiles('name')( $key ) ) {
            $file = array(
                'name' => $otherfiles('name')( $key ),
                'type' => $otherfiles('type')( $key ),
                'tmp_name' => $otherfiles('tmp_name')( $key ),
                'error' => $otherfiles('error')( $key ),
                'size' => $otherfiles('size')( $key ),
            );
            $_FILES('trabajos_empresa') = $file;
            $attachment_id = media_handle_upload( 'trabajos_empresa', $post_id );
            update_post_meta( $post_id,'_studiare_portafolio', $attachment_id );
            var_dump($attachment_id);
            if ( is_wp_error( $attachment_id ) ) {
                // There was an error uploading the image.
                echo 'Error adding file';
            } else {
                // The image was uploaded successfully!
                //Echo to see if image upload fine
                echo 'File added successfully with ID: ' . $attachment_id . '<br>';
                echo wp_get_attachment_image( $attachment_id, array( 800, 600 ) ) . '<br>'; // Display the uploaded image with a size you wish. In this case it is 800x600
            }
        }
    }

And the html im using is

 <input type="file" name="post_image" id="post_image" aria-required="true"> 

            <input type="file" name="trabajos_empresa()" id="trabajos_empresa" aria-required="true" multiple="multiple">

if i do a var_dump i get all the files uploaded in the input trabajos_empresa but nothing is save in my media gallery

9 – S3FS IMCE File upload issue for old files in Upgraded site

I have a question on IMCE File upload. Hope someone might have come across the similar issue.

Installed modules:

We have added a file/image field and chosen following option from Manage form display (admin/structure/types/manage/mycontent-type/form-display) to have Open File Browser option above the specific field.

Allow users to select files from Imce File Manager for this field.

Also, We have configured right way to populate specific S3 bucket files when we click on File Browser option. We could see all our S3 bucket files when
We have upgraded our Drupal 8.x site to the latest Drupal 9.2.4.

The only problem is that, we are able to upload new files but not able to select old files. When we select old files, it just loads field and nothing happens.

Unfortunately, we could see the only error when we try to upload a old file and looks like this is not the root cause.

#0 ROOT-FOLDERcoreincludesbootstrap.inc(312): _drupal_error_handler_real(2, 'strip_tags() ex...', 'D:\Applications...', 103)
#1 (internal function): _drupal_error_handler(2, 'strip_tags() ex...', 'D:\Applications...', 103, Array)
#2 ROOT-FOLDERvendortwigtwigsrcEnvironment.php(418) : eval()'d code(103): strip_tags(Array)
#3 ROOT-FOLDERvendortwigtwigsrcTemplate.php(405): __TwigTemplate_2a6388b68ac7765833842f4b9b7c85edae837f9d5494558acc0881d920a11091->doDisplay(Array, Array)
#4 ROOT-FOLDERvendortwigtwigsrcTemplate.php(378): TwigTemplate->displayWithErrorHandling(Array, Array)
#5 ROOT-FOLDERvendortwigtwigsrcTemplate.php(390): TwigTemplate->display(Array)
#6 ROOT-FOLDERcorethemesenginestwigtwig.engine(65): TwigTemplate->render(Array)
#7 ROOT-FOLDERcorelibDrupalCoreThemeThemeManager.php(384): twig_render_template('themes/custom/b...', Array)
#8 ROOT-FOLDERcorelibDrupalCoreRenderRenderer.php(436): DrupalCoreThemeThemeManager->render('html', Array)
#9 ROOT-FOLDERcorelibDrupalCoreRenderRenderer.php(201): DrupalCoreRenderRenderer->doRender(Array, true)
#10 ROOT-FOLDERcorelibDrupalCoreRenderRenderer.php(145): DrupalCoreRenderRenderer->render(Array, true)
#11 ROOT-FOLDERcorelibDrupalCoreRenderRenderer.php(578): DrupalCoreRenderRenderer->DrupalCoreRender{closure}()
#12 ROOT-FOLDERcorelibDrupalCoreRenderRenderer.php(146): DrupalCoreRenderRenderer->executeInRenderContext(Object(DrupalCoreRenderRenderContext), Object(Closure))
#13 ROOT-FOLDERcorelibDrupalCoreRenderBareHtmlPageRenderer.php(66): DrupalCoreRenderRenderer->renderRoot(Array)
#14 ROOT-FOLDERcorelibDrupalCoreProxyClassRenderBareHtmlPageRenderer.php(76): DrupalCoreRenderBareHtmlPageRenderer->renderBarePage(Array, Object(DrupalCoreStringTranslationTranslatableMarkup), 'imce_page', Array)
#15 ROOT-FOLDERmodulescontribimcesrcImceFM.php(689): DrupalCoreProxyClassRenderBareHtmlPageRenderer->renderBarePage(Array, Object(DrupalCoreStringTranslationTranslatableMarkup), 'imce_page', Array)
#16 ROOT-FOLDERmodulescontribimcesrcImceFM.php(708): DrupalimceImceFM->buildRenderPage()
#17 ROOT-FOLDERmodulescontribimcesrcImce.php(27): DrupalimceImceFM->pageResponse()
#18 ROOT-FOLDERmodulescontribimcesrcControllerImceController.php(35): DrupalimceImce::response(Object(SymfonyComponentHttpFoundationRequest), Object(DrupalCoreSessionAccountProxy), 's3')
#19 (internal function): DrupalimceControllerImceController->page('s3', Object(SymfonyComponentHttpFoundationRequest))
#20 ROOT-FOLDERcorelibDrupalCoreEventSubscriberEarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#21 ROOT-FOLDERcorelibDrupalCoreRenderRenderer.php(578): DrupalCoreEventSubscriberEarlyRenderingControllerWrapperSubscriber->DrupalCoreEventSubscriber{closure}()
#22 ROOT-FOLDERcorelibDrupalCoreEventSubscriberEarlyRenderingControllerWrapperSubscriber.php(124): DrupalCoreRenderRenderer->executeInRenderContext(Object(DrupalCoreRenderRenderContext), Object(Closure))
#23 ROOT-FOLDERcorelibDrupalCoreEventSubscriberEarlyRenderingControllerWrapperSubscriber.php(97): DrupalCoreEventSubscriberEarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#24 ROOT-FOLDERvendorsymfonyhttp-kernelHttpKernel.php(158): DrupalCoreEventSubscriberEarlyRenderingControllerWrapperSubscriber->DrupalCoreEventSubscriber{closure}()
#25 ROOT-FOLDERvendorsymfonyhttp-kernelHttpKernel.php(80): SymfonyComponentHttpKernelHttpKernel->handleRaw(Object(SymfonyComponentHttpFoundationRequest), 1)
#26 ROOT-FOLDERcorelibDrupalCoreStackMiddlewareSession.php(57): SymfonyComponentHttpKernelHttpKernel->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true)
#27 ROOT-FOLDERcorelibDrupalCoreStackMiddlewareKernelPreHandle.php(47): DrupalCoreStackMiddlewareSession->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true)
#28 ROOT-FOLDERcorelibDrupalCoreStackMiddlewareReverseProxyMiddleware.php(47): DrupalCoreStackMiddlewareKernelPreHandle->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true)
#29 ROOT-FOLDERcorelibDrupalCoreStackMiddlewareNegotiationMiddleware.php(52): DrupalCoreStackMiddlewareReverseProxyMiddleware->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true)
#30 ROOT-FOLDERvendorstackbuildersrcStackStackedHttpKernel.php(23): DrupalCoreStackMiddlewareNegotiationMiddleware->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true)
#31 ROOT-FOLDERcorelibDrupalCoreDrupalKernel.php(717): StackStackedHttpKernel->handle(Object(SymfonyComponentHttpFoundationRequest), 1, true)
#32 ROOT-FOLDERindex.php(19): DrupalCoreDrupalKernel->handle(Object(SymfonyComponentHttpFoundationRequest))
#33 {main}

Could someone please help us in finding the root cause of the issue?

Upload videos to IGTV in Instagram besides the 9:16 and 16:9 ratio, as some accounts have done

Is there a way (on cellphone, via Facebook or whatever) to upload a video in actual 4:3 ratio to IGTV in Instagram and keep that proportion everywhere (much like in regular Instagram posts), instead of having to keep it locked and cropped on 16:9 or 9:16? I had seen a couple of accounts that actually have done that (https://www.instagram.com/tv/CKMLclPjB4G/ and https://www.instagram.com/tv/CQmBImnhaMl/ , note the later is not even a verified account), yet I fear it was some kind of temporal bug, but still.

security – Why does encryption doesn’t work/apply to access device storage or Google photos or drive when we upload a file from device/cloud to any webpage/apps

Example : YouTube, Facebook, Instagram, Chrome ( any app )
If I’m accessing YouTube or any other app where I can upload content from Android device with or without the app lock features, whenever I click on add file, it doesn’t ask for gallery password even though I have my phone’s gallery encrypted with app lock, infact, in some apps even the hidden files also appear. What’s the point of having app lock if anyone can access all the files through any other app’s upload feature ? Does Android not provide any security or encryption facility to access device storage when accessing it (storage) through a third-party app? Anybody can access Google photos, drive storage etc without any password if they have access to the device, doesn’t matter whether the apps are password protected or not.
To explain further , in this case let’s say my Chrome isn’t password protected, if anyone has access to my device’s Chrome browser, they can access all of my content from Google photos, drive, phone’s storage etc just by using any webpage’s upload file feature. What’s the point of keeping password pr applock to gallery / or Google storage if they’re acceible like that?
Faced this issue is most Android devices ( Redmi note 5 pro, Samsung devices, Nokia, oppo, vivo etc.)

custom post types – metabox upload multiple file

I have upload multiple file metabox, my problem is I need to display all files links attached to this post inside the post editor. when i upload the files it is already saved under the media but the links are not showing!! please note that in frontend form the links displayed normally!

 add_meta_box(
    'file_metabox', // metabox ID
    'File Upload', // title
    'file_metabox_callback', // callback function
    'job', // post type or post types in array
    'normal', // position (normal, side, advanced)
    'default' // priority (default, low, high, core)
);

 

   function file_metabox_callback($post)
{

    wp_nonce_field(basename(__FILE__), 'file_metabox_nonce');
    
    // here is my problem!!!

    $args = array(
        'post_type' => 'attachment',
        'post_parent' => $post->ID
    );

    echo '<ul>';
    foreach (get_posts($args) as $image) {
        echo '<li><a href="' . wp_get_attachment_url($image->ID) . '" target="_blank">' . basename(get_attached_file($image->ID)) . '</a></li>';
    }
    echo '</ul>';

    echo '<form method="POST" name="vendor_form" enctype="multipart/form-data">';
    echo '<input class="form-control" type="file" id="file_metabox" name="file_metabox()" multiple="multiple">';
    echo '</form>';
}

function file_save_meta($post_id, $post)
{

    // nonce check
    if (!isset($_POST('_mishanonce')) || !wp_verify_nonce($_POST('_mishanonce'), 'somerandomstr')) {
        return $post_id;
    }

    // check current use permissions
    $post_type = get_post_type_object($post->post_type);

    if (!current_user_can($post_type->cap->edit_post, $post_id)) {
        return $post_id;
    }

    // Do not save the data if autosave
    if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {
        return $post_id;
    }

    // define your own post type here
    if ($post->post_type != 'job') {
        return $post_id;
    }

 


    if ($_FILES) {
        $files = $_FILES("file_metabox");
        foreach ($files('name') as $key => $value) {
            if ($files('name')($key)) {
                $file = array(
                    'name' => $files('name')($key),
                    'type' => $files('type')($key),
                    'tmp_name' => $files('tmp_name')($key),
                    'error' => $files('error')($key),
                    'size' => $files('size')($key)
                );
                $_FILES = array("file_metabox" => $file);
                foreach ($_FILES as $file => $array) {
                    // $newupload = frontend_handle_attachment( $file, $post_success );
                    if ($_FILES($file)('error') !== UPLOAD_ERR_OK) __return_false();

                    require_once(ABSPATH . "wp-admin" . '/includes/image.php');
                    require_once(ABSPATH . "wp-admin" . '/includes/file.php');
                    require_once(ABSPATH . "wp-admin" . '/includes/media.php');

                    $attach_id = media_handle_upload($file, $post_success);

                    
                    add_post_meta($post_id, 'file_metabox', $attach_id);
                    update_post_meta($post_id, 'file_metabox', $attach_id);
                }
                return $attach_id;
            }
        }
    }

    return $post_id;
}
 

and here is the function of the frontend form which is working perfectly!

add_action('init', 'vendor_new_post');

function vendor_new_post($post_id)
{

    if (isset($_POST('submit_seo')) || isset($_POST('vendor_file_flag'))) {


        $first_name = sanitize_text_field($_POST('submitted_first_name'));
        $seo_title = sanitize_text_field($_POST('submitted_seo_title'));
        $seo_robots = sanitize_text_field($_POST('submitted_seo_robots'));

        $vendor_post = array(
            'post_type' => 'job',
            'post_title' => $first_name,
            'post_status' => 'publish',
            'meta_input' => array(
                'first_name' => $first_name,
                'seo_title' => $seo_title,
                'seo_robots' => $seo_robots

            )
        );

        $post_success = wp_insert_post($vendor_post);
        update_post_meta($post_id, 'file_metabox_callback', $post_success);

        if ($_FILES) {
            $files = $_FILES("vendor_file");
            foreach ($files('name') as $key => $value) {
                if ($files('name')($key)) {
                    $file = array(
                        'name' => $files('name')($key),
                        'type' => $files('type')($key),
                        'tmp_name' => $files('tmp_name')($key),
                        'error' => $files('error')($key),
                        'size' => $files('size')($key)
                    );
                    $_FILES = array("vendor_file" => $file);
                    foreach ($_FILES as $file => $array) {
                        // $newupload = frontend_handle_attachment( $file, $post_success );
                        if ($_FILES($file)('error') !== UPLOAD_ERR_OK) __return_false();

                        require_once(ABSPATH . "wp-admin" . '/includes/image.php');
                        require_once(ABSPATH . "wp-admin" . '/includes/file.php');
                        require_once(ABSPATH . "wp-admin" . '/includes/media.php');

                        $attach_id = media_handle_upload($file, $post_success);

                       
                        update_post_meta($post_success, 'file_metabox', $attach_id);
                    }
                }
            }
        }
    }
}

How to upload all Android photo gallery Albums to Dropbox?

I currently have my phone’s digital photos uploading to my Dropbox “Camera Uploads” folder, but I recently discovered that some of the folders in my Gallery > Albums are not uploading. For example, I downloaded photos from the Disneyland app to my Android. Those photos were saved in my Gallery/Albums in a folder called “Disney”. Those photos have not uploaded to Dropbox. Meanwhile, other folders in Gallery/Albums (such as my Screenshots folder) have uploaded to Dropbox.

Why would some folders not upload? Is there anything I can do too ensure that every single Album/photo is uploaded to Dropbox automatically?

javascript – How to upload HTML and CSS file and execute them in React Application?

In my react application there will be a file upload options like below:

enter image description here

Here user will upload HTML and CSS file and I need those uploaded files to be rendered in the Application at runtime. Like WordPress theme upload options.

How can I solve this problem?

#TIA

javascript – Trying to upload document in “Attachment” column of SharePoint list

I am trying to upload document in “Attachment” column of SharePoint list. I am able to upload the document but not view the document. The SharePoint list is given below image:-
enter image description here

When I am click on the “Attachment” column for view the document then not able to view the document. The error which is showing when I am click on that column is given in below image:-
enter image description here

Here I am using below code for upload the document in “Attachment” column :-

function Submitbtn(event) {
var listName = "AttachementTestList"
var itemType = GetItemTypeForListName(listName);
var item = {
    "__metadata": { "type": itemType },
    "Title": $("#txtName").val(),
};

$.ajax({
    url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items",
    type: "POST",
    contentType: "application/json;odata=verbose",
    data: JSON.stringify(item),
    headers: {
        "Accept": "application/json;odata=verbose",
        "X-RequestDigest": $("#__REQUESTDIGEST").val()
    },
    success: function (data) {
        var itemId = data.d.Id;
        var Path = $("#txtfile").val();
        var file = $("#txtfile").prop("files")(0);
        var uploadedfile = file.name;
        $.ajax
            ({
                url: _spPageContextInfo.siteAbsoluteUrl + "/_api/web/lists/getbytitle('" + listName + "')/items(" + itemId + ")/AttachmentFiles/add(FileName='" + uploadedfile + "')",
                type: "POST",
                data: JSON.stringify
                    ({
                        __metadata:
                        {
                            type: "SP.Data.AttachementTestListListItem"
                        },
                        Path: Path,
                    }),
                headers:
                {
                    "Accept": "application/json;odata=verbose",
                    "Content-Type": "application/json;odata=verbose",
                    "X-RequestDigest": $("#__REQUESTDIGEST").val(),
                    "X-HTTP-Method": "POST"
                },
                success: function (data) {
                    alert("Data Submitted Successfull");
                },
                error: function (xhr, status, error) {
                    console.error(xhr.responseJSON.error.message);
                }
            });
       
    },
    error: function (data) {

        console.log("not submitted");
    }
});

}

function GetItemTypeForListName(name) {
return “SP.Data.” + name.charAt(0).toUpperCase() + name.split(” “).join(“”).slice(1) + “ListItem”;
}