hallo,
ik heb een probleem. Ik wil aan een email een attachment toevoegen waarmee mensen een foto kunnen toesturen.
Nou heb ik een scripje waarmee je de mogelijkheid hebt, maar hij wil telkens niet de foto meesturen.
Voor de goeie php-ers sluit ik maar meteen de code bij, kunnen jullie je er op uitleven??
We krijgen telkens deze melding:
Couldn't copy image 1 to server
Alvast bedankt!
*.* wordt natuurlijk vervangen door een pad...
ik heb een probleem. Ik wil aan een email een attachment toevoegen waarmee mensen een foto kunnen toesturen.
Nou heb ik een scripje waarmee je de mogelijkheid hebt, maar hij wil telkens niet de foto meesturen.
Voor de goeie php-ers sluit ik maar meteen de code bij, kunnen jullie je er op uitleven??
We krijgen telkens deze melding:
Couldn't copy image 1 to server
Alvast bedankt!
*.* wordt natuurlijk vervangen door een pad...
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
| <? //user defined variables $abpath = "*.*"; $sizelim = "no"; $size = "2500000"; $cert1 = "image/pjpeg"; //Jpeg type 1 $cert2 = "image/jpeg"; //Jpeg type 2 $cert3 = "image/gif"; //Gif type $log = ""; $random1 = rand(1, 99999999); $random2 = rand(1, 99999999); $random3 = rand(1, 99999999); $random4 = rand(1, 99999999); $random5 = rand(1, 99999999); //begin upload 1 //checks if file exists if ($img1_name == "") { $log .= "No file selected for upload 1<br>"; } if ($img1_name != "") { //checks if file exists if (file_exists("$abpath/$img1_name")) { $log .= "File 1 already existed<br>"; } else { //checks if files to big if ($sizelim == "yes") { if ($img1_size > $size) { $log .= "File 1 was too big<br>"; } } //Checks if file is an image if (($img1_type == $cert1) or ($img1_type == $cert2) or ($img1_type == $cert3)) { if (($img1_type == $cert1) or ($img1_type == $cert2)) { $img1_name = $random1 . ".jpeg"; } if ($img1_type == $cert3) { $img1_name = $random1 . ".gif"; } @copy($img1, "$abpath/$img1_name") or $log .= "Couldn't copy image 1 to server<br>"; if (file_exists("$abpath/$img1_name")) { $log .= "File 1 was uploaded<br>"; } } else { $log .= "File 1 is not an image<br>"; } } } //checks if file exists if ($img2_name == "") { $log .= "No file selected for upload 2<br>"; } if ($img2_name != "") { //checks if file exists if (file_exists("$abpath/$img2_name")) { $log .= "File 2 already existed<br>"; } else { //checks if files to big if ($sizelim == "yes") { if ($img2_size > $size) { $log .= "File 2 was too big]<br>"; } } //Checks if file is an image if (($img2_type == $cert1) or ($img2_type == $cert2) or ($img2_type == $cert3)) { if (($img2_type == $cert1) or ($img2_type == $cert2)) { $img2_name = $random2 . ".jpeg"; } if ($img2_type == $cert3) { $img2_name = $random2 . ".gif"; } @copy($img2, "$abpath/$img2_name") or $log .= "Couldn't copy image 2 to server<br>"; if (file_exists("$abpath/$img2_name")) { $log .= "File 2 was uploaded<br>"; } } else { $log .= "File 2 is not an image<br>"; } } } if ($img3_name == "") { $log .= "No file selected for upload 3<br>"; } if ($img3_name != "") { //checks if file exists if (file_exists("$abpath/$img3_name")) { $log .= "File 3 already existed<br>"; } else { //checks if files to big if ($sizelim == "yes") { if ($img3_size > $size) { $log .= "File 3 was too big<br>"; } } //Checks if file is an image if (($img3_type == $cert1) or ($img3_type == $cert2) or ($img3_type == $cert3)) { if (($img3_type == $cert1) or ($img3_type == $cert2)) { $img3_name = $random3 . ".jpeg"; } if ($img3_type == $cert3) { $img3_name = $random3 . ".gif"; } @copy($img3, "$abpath/$img3_name") or $log .= "Couldn't copy image 3 to server<br>"; if (file_exists("$abpath/$img3_name")) { $log .= "File 3 was uploaded<br>"; } } else { $log .= "File 3 is not an image<br>"; } } } if ($img4_name == "") { $log .= "No file selected for upload 4<br>"; } if ($img4_name != "") { //checks if file exists if (file_exists("$abpath/$img4_name")) { $log .= "File 4 already existed<br>"; } else { //checks if files to big if ($sizelim == "yes") { if ($img4_size > $size) { $log .= "File 4 was too big<br>"; } } //Checks if file is an image if (($img4_type == $cert1) or ($img4_type == $cert2) or ($img4_type == $cert3)) { if (($img4_type == $cert1) or ($img4_type == $cert2)) { $img4_name = $random4 . ".jpeg"; } if ($img4_type == $cert3) { $img4_name = $random4 . ".gif"; } @copy($img4, "$abpath/$img4_name") or $log .= "Couldn't copy image 4 to server<br>"; if (file_exists("$abpath/$img4_name")) { $log .= "File 4 was uploaded<br>"; } } else { $log .= "File 4 is not an image<br>"; } } } if ($img5_name == "") { $log .= "No file selected for upload 5<br>"; } if ($img5_name != "") { //checks if file exists if (file_exists("$abpath/$img5_name")) { $log .= "File 5 already existed<br>"; } else { //checks if files to big if ($sizelim == "yes") { if ($img5_size > $size) { $log .= "File 5 was too big<br>"; } } //Checks if file is an image if (($img5_type == $cert1) or ($img5_type == $cert2) or ($img5_type == $cert3)) { if (($img5_type == $cert1) or ($img5_type == $cert2)) { $img5_name = $random5 . ".jpeg"; } if ($img1_type == $cert3) { $img5_name = $random5 . ".gif"; } @copy($img5, "$abpath/$img5_name") or $log .= "Couldn't copy image 5 to server<br>"; if (file_exists("$abpath/$img5_name")) { $log .= "File 5 was uploaded<br>"; } } else { $log .= "File 5 is not an image<br>"; } } } ?> |