Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (27 sloc) 1.06 kb
9a68221 Andrea Giammarchi kangax here I am
authored
1 <?php
2
3 // iframe creation, just an empty page
4 if(isset($_GET['AjaxUploadFrame']))
5 exit;
6
7 // populate in a fast and completely unobtrusive way the super global
8 // $_FILES variable if the browser sent file via Ajax and without boundary
9 // to use only if you want to support Safari 4 beta
10 require 'noswfupload.php';
11
12 // directory used to store files
13 $uploadFolder = 'upload';
14
15 if(
16 isset($_FILES['test']) && (
17
18 // normal sent file
19 move_uploaded_file($_FILES['test']['tmp_name'], $uploadFolder.DIRECTORY_SEPARATOR.$_FILES['test']['name']) ||
20
21 // files created via noswfupload.php (Safari 4 beta)
22 copy($_FILES['test']['tmp_name'], $uploadFolder.DIRECTORY_SEPARATOR.$_FILES['test']['name'])
23 )
24 ){
25 // in copy case, Safari 4 beta, files will not be removed, do it manually
26 if(file_exists($_FILES['test']['tmp_name']))
27 unlink($_FILES['test']['tmp_name']);
28
29 // upload completed
30 exit('OK');
31 }
32
33 // if something was wrong ... should generate onerror event
34 header('HTTP/1.1 500 Internal Server Error');
35
36 ?>
Something went wrong with that request. Please try again.