POST data in een var
var $originalDir = '../../data/original/$_POST[cat]';
ook niet om postdata vooraf in een array te plaatsen.
hebben jullie een oplossing?
groet Koosje
$_POST is een array() dus gebruik daar ook (enkele) quotes.
$originalDir = '../../data/original/' . $_POST['cat'];
// Directories to store images
var $baseDir = '';
var $originalDir = '../../data/original' . $_POST[çat'];
var $normalDir = '../../data/normal';
var $thumbDir = '../../data/thumbnail';
Je hebt je quootje in de $_POST aan de c geplakt.
OK, dat was een schrijf fout in het vorige bericht, maar zoals jij het beschrijft werkt het ook niet. Zijn er twee dollartekens mogelijk in een lijn.
Kan iemand vertellen of het uberhaupt mogelijk is?
Meerdere $ tekens op 1 regel is geen probleem ik zie nu alleen niet waarom hetgeen santhe heeft neergezet niet zou werken
Code (php)
1
2
3
4
5
2
3
4
5
<?php
$myImageUpload = new maxImageUpload();
//$myUpload->setUploadLocation(getcwd().DIRECTORY_SEPARATOR);
$myImageUpload->uploadImage();
?>
$myImageUpload = new maxImageUpload();
//$myUpload->setUploadLocation(getcwd().DIRECTORY_SEPARATOR);
$myImageUpload->uploadImage();
?>
1. <br>
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
class maxImageUpload {
// Maximum upload size
var $maxUploadSize = 10; // 10 Mb
// Image sizes
var $normalWidth = 320;
var $normalHeight = 200;
var $thumbWidth = 150;
var $thumbHeight = 94;
// Image quality
var $imageQualityNormal = 5; //1:Poor ... 5:Very good
var $imageQualityThumb = 5; //1:Poor ... 5:Very good
// Directories to store images
var $baseDir = '';
// var $originalDir = '../../data/original/' . $_POST['cat'];
// var $originalDir = '../../data/original'. "$arrcat".';
// var $originalDir ='./../data/original/' " . $_POST['cat'] . ";
// var $originalDir = '../../data/original';
var $originalDir = '../../data/original';
var $normalDir = '../../data/normal';
var $thumbDir = '../../data/thumbnail';
// File postfixes
var $originalPrefix = '';
var $normalPrefix = '';
var $thumbPrefix = '';
// Internal used variables
var $error = '';
var $maxMemoryUsage = 128; // 128 Mb
/**
* Constructor to initialize class varaibles
* The upload locations will be set to the actual
* working directory
*
* @return maxImageUpload
*/
function maxImageUpload(){
if (!file_exists($this->baseDir)) {
if (!@mkdir($this->baseDir)){
$this->baseDir = getcwd();
}
}
$this->originalDir = $this->baseDir.DIRECTORY_SEPARATOR.$this->originalDir.DIRECTORY_SEPARATOR;
if (!file_exists($this->originalDir)) {
mkdir($this->originalDir);
}
$this->normalDir = $this->baseDir.DIRECTORY_SEPARATOR.$this->normalDir.DIRECTORY_SEPARATOR;
if (!file_exists($this->normalDir)) {
mkdir($this->normalDir);
}
$this->thumbDir = $this->baseDir.DIRECTORY_SEPARATOR.$this->thumbDir.DIRECTORY_SEPARATOR;
if (!file_exists($this->thumbDir)) {
mkdir($this->thumbDir);
}
}
/**
* This function sets the directory where to upload the file
* In case of Windows server use the form: c:\\temp
* In case of Unix server use the form: /tmp
*
* @param String Directory where to store the files
*/
function setUploadBaseLocation($dir){
$this->baseDir = $dir;
}
function showUploadForm($msg='',$error=''){
?>
class maxImageUpload {
// Maximum upload size
var $maxUploadSize = 10; // 10 Mb
// Image sizes
var $normalWidth = 320;
var $normalHeight = 200;
var $thumbWidth = 150;
var $thumbHeight = 94;
// Image quality
var $imageQualityNormal = 5; //1:Poor ... 5:Very good
var $imageQualityThumb = 5; //1:Poor ... 5:Very good
// Directories to store images
var $baseDir = '';
// var $originalDir = '../../data/original/' . $_POST['cat'];
// var $originalDir = '../../data/original'. "$arrcat".';
// var $originalDir ='./../data/original/' " . $_POST['cat'] . ";
// var $originalDir = '../../data/original';
var $originalDir = '../../data/original';
var $normalDir = '../../data/normal';
var $thumbDir = '../../data/thumbnail';
// File postfixes
var $originalPrefix = '';
var $normalPrefix = '';
var $thumbPrefix = '';
// Internal used variables
var $error = '';
var $maxMemoryUsage = 128; // 128 Mb
/**
* Constructor to initialize class varaibles
* The upload locations will be set to the actual
* working directory
*
* @return maxImageUpload
*/
function maxImageUpload(){
if (!file_exists($this->baseDir)) {
if (!@mkdir($this->baseDir)){
$this->baseDir = getcwd();
}
}
$this->originalDir = $this->baseDir.DIRECTORY_SEPARATOR.$this->originalDir.DIRECTORY_SEPARATOR;
if (!file_exists($this->originalDir)) {
mkdir($this->originalDir);
}
$this->normalDir = $this->baseDir.DIRECTORY_SEPARATOR.$this->normalDir.DIRECTORY_SEPARATOR;
if (!file_exists($this->normalDir)) {
mkdir($this->normalDir);
}
$this->thumbDir = $this->baseDir.DIRECTORY_SEPARATOR.$this->thumbDir.DIRECTORY_SEPARATOR;
if (!file_exists($this->thumbDir)) {
mkdir($this->thumbDir);
}
}
/**
* This function sets the directory where to upload the file
* In case of Windows server use the form: c:\\temp
* In case of Unix server use the form: /tmp
*
* @param String Directory where to store the files
*/
function setUploadBaseLocation($dir){
$this->baseDir = $dir;
}
function showUploadForm($msg='',$error=''){
?>
- SanThe - op 18/04/2012 20:48:00:
Vars buiten quotes houden.
$_POST is een array() dus gebruik daar ook (enkele) quotes.
$_POST is een array() dus gebruik daar ook (enkele) quotes.
Wordt fatsoenlijk dit: