Forum poświęcone PHP
Witam wszystkich serdecznie.. tym razem jednak nie z Polski. Jak w samym temacie napisałem - jestem w Singapurze. Początkowo miała być Korea, ale wygrała opcja z oficjalnym językiem angielskim. Jeśli znajdę pracę, planuje zostać tu na dłużej lub wręcz stałe. Zobaczymy. Przybyłem tu wczoraj (około 18:00 czasu lokalnego czyli 12:00 czasu Polskiego). Trasa Wrocław ---[Wizzair W6 551]---> Londyn Luton ---[bus NationalExpress linii 707]---> Londyn Heathrow, Terminal 4 ---[Quantas Airways QF10] ---> Singapur. Obecnie wynajmuję pokój w dzielonym apartamencie: 1400SGD czyli około 2100PLN za dwie osoby za miesiąc. Basen, korty tenisowe, parking i ochrona do bezpłatnej dyspozycji mieszkańców budynku. Ceny żywności nieznacznie niższe niż w Polsce, chemia domowa wydaje się być tańsza. Rano temperatura jakby stało się nad gotującym garnkiem: ciepło i bardzo wilgotno; po południu pogoda jak nad wrzącym garnkiem: i gorąco, i niesamowicie wilgotno. Mój pierwszy "szok kulturowy" - kupowanie karty pre-paid na telefon.. Nie wiedziałem, że wybór fajnego numeru jest tak kluczowy?! W sklepach, jeśli chodzi o żywność to dostępnych jest dużo marek widywanych w Polsce (Nutella, Heinekken, Snickers, itp.), choć w dziale chemii wydają się znacznie dominować produkty chińskie [na pierwszy rzut oka lepiej opakowane niż produkty w Polsce, co do jakości jeszcze za wcześnie by oceniać, ale zapewne od polskich nie będą się różnić wiele lub wcale]. Jedzenia nie można zostawiać na wierzchu - zanim by spleśniało, wyniosłyby je te maleńkie mróweczki. Wszystko w koło jest o wiele bardziej zadbane (dziś widziałem obsługę budynku zrywającą w palmy butwiejące liście), czystsze, a efektów wandalizmu nie widać wcale. Na razie to tyle, jak poznam więcej, może jeszcze coś dopiszę.
Mon,18 Aug 2008 04:08:42 +0100
Chciałbym zrobić podobne pole do edycji kodu jak w samym edytorze kodu Delphi (kolorujące daną funkcję, liczbę i tekst), jednak nie wiem jak się do tego zabrać. Może jest już taki komponent wbudowany? Jeśli nie, to jak go zrobić, czy jest może jakiś kurs?
Sun,17 Aug 2008 23:52:43 +0100
Otóż zrobiłem prosty odtwarzacz i chciałbym do niego zrobić wybieranie pliku. W windowsie istnieje już takie okno typu "Wybierz plik i naciśnij Otwórz". A więc czy da się jakoś wywołać to okno? a jeśli nie to jak to zrobić?
Sun,17 Aug 2008 23:33:20 +0100
czesc uzywam phpmailer do wysylania listow, jednak mam taki problem ze potrzebuje zrobic tak by nie bylo widac listy adresow e-mail odbiorcow gdy przychodza listy do nich(jest to newsletter). Nalezy uzyc do tego jakiegos dodatkowego naglowka? czy jest moze taka funkcja w phpmailer(nie moglem znalezc0
Sun,17 Aug 2008 23:21:13 +0100
Witam... Zostałem poproszony o napisanie programu, który ma otwierać jakąś aplikacje z określonym parametrem... zastanawiałem się pomiędzy dwoma sposobami. 1, dotyczył odpalania przez otwarcie pliku bezpośrednio z katalogu, 2, przy użyciu konsoli. Zatrzymałem się przy 2 sposobie jednak napotkałem problem. Przy ożyciu funkcji system(), i wpisaniu do niej ścieżki dostępu i próbie dodania parametru z TEdit, kompilator nie uruchamia programu tylko wyświetla komunikat o nie możliwości konwersji Ansistring do const char* kod wygląda tak: system("Sciezka dostepu do pliku", Edit1->Text) W jaki sposób mogę zastosować parametr ?
Sun,17 Aug 2008 22:44:56 +0100
Rozdział 38. Handling file uploads
POST method uploads
This feature lets people upload both text and binary files. With PHP's authentication and file manipulation functions, you have full control over who is allowed to upload and what is to be done with the file once it has been uploaded.
PHP is capable of receiving file uploads from any RFC-1867 compliant browser (which includes Netscape Navigator 3 or later, Microsoft Internet Explorer 3 with a patch from Microsoft, or later without a patch).
Related Configurations Note: See also the file_uploads, upload_max_filesize, upload_tmp_dir, post_max_size and max_input_time directives in php.ini
PHP also supports PUT-method file uploads as used by Netscape Composer and W3C's Amaya clients. See the PUT Method Support for more details.
Notatka: Be sure your file upload form has attribute enctype="multipart/form-data" otherwise the file upload will not work.
The global $_FILES
exists as of PHP 4.1.0 (Use $HTTP_POST_FILES
instead if using an earlier version).
These arrays will contain all the uploaded file information.
The contents of $_FILES from the example form is as follows. Note that this assumes the use of the file upload name userfile, as used in the example script above. This can be any name.
$_FILES['userfile']['name']The original name of the file on the client machine.
$_FILES['userfile']['type']The mime type of the file, if the browser provided this information. An example would be "image/gif". This mime type is however not checked on the PHP side and therefore don't take its value for granted.
$_FILES['userfile']['size']The size, in bytes, of the uploaded file.
$_FILES['userfile']['tmp_name']The temporary filename of the file in which the uploaded file was stored on the server.
$_FILES['userfile']['error']The error code associated with this file upload. This element was added in PHP 4.2.0
Files will, by default be stored in the server's default temporary
directory, unless another location has been given with the upload_tmp_dir directive in
php.ini. The server's default directory can
be changed by setting the environment variable
TMPDIR in the environment in which PHP runs.
Setting it using putenv() from within a PHP
script will not work. This environment variable can also be used
to make sure that other operations are working on uploaded files,
as well.
Przykład 38-2. Validating file uploads See also the function entries for is_uploaded_file() and move_uploaded_file() for further information. The following example will process the file upload that came from a form.
|
The PHP script which receives the uploaded file should implement
whatever logic is necessary for determining what should be done
with the uploaded file. You can, for example, use the
$_FILES['userfile']['size'] variable
to throw away any files that are either too small or too big. You
could use the
$_FILES['userfile']['type'] variable
to throw away any files that didn't match a certain type criteria, but
use this only as first of a series of checks, because this value
is completely under the control of the client and not checked on the PHP
side.
As of PHP 4.2.0, you could use $_FILES['userfile']['error']
and plan your logic according to the error codes.
Whatever the logic, you should either delete the file from the
temporary directory or move it elsewhere.
If no file is selected for upload in your form, PHP will return
$_FILES['userfile']['size'] as 0, and
$_FILES['userfile']['tmp_name'] as none.
The file will be deleted from the temporary directory at the end of the request if it has not been moved away or renamed.
Przykład 38-3. Uploading array of files PHP supports HTML array feature even with files.
|
| Poprzedni | Spis treści | Następny |
| Dealing with XForms | Początek rozdziału | Error Messages Explained |