sql >> Database >  >> RDS >> Mysql

Bestand uploaden Ajax PHP

Doe in uw Javascript

$(function(){
        var btnUpload=$('#me');
        var mestatus=$('#mestatus');
        var files=$('#files');
        new AjaxUpload(btnUpload, {
            action: '../UploadDoc/Upload.php',
            name: 'uploadfile',
            params: {
                  pageKey: 'HtmlPage1_'
            }
      ......ETC-CODE......................

OF uw javascript-code doet

$(function(){
        var btnUpload=$('#me');
        var mestatus=$('#mestatus');
        var files=$('#files');
        new AjaxUpload(btnUpload, {
            action: '../UploadDoc/Upload.php?pageKey=HtmlPage1_',
            name: 'uploadfile',
      ......ETC-CODE......................

En doe in je PHP:

<?php
/* Set the location to upload the file to */
$uploaddir = '../documents/userdocs/'; 

/* Set the name and file extension of the file being saved */
$file = $uploaddir .$_REQUEST['pageKey'].basename($_FILES['uploadfile']['name']); 
$file_name= $_REQUEST['pageKey'].$_FILES['uploadfile']['name']; 
......ETC-CODE......................

Vervolgens wijzigt u uw javascript-code op elke pagina in een "pageKey"-parameter.




  1. Mysql extraheert de eerste letter van elk woord in een specifieke kolom

  2. Prestaties van ruimtelijke MySQL-query's verbeteren

  3. Oracle 11g CREATE VIEW met CONNECT BY en meerdere tabellen

  4. MySQL corrumpeert na elke herstart van de server