With the full path to the uploaded file, I want to modify my form to upload files to the server database .
Code:
// EDYCJA Agenta function edycja_agenta ($ id) {$ q = "select id, ostatnie_logowanie, profil_id, Adres_ip, status, localization, adres_mac, wersja_programu agri WHERE id = $ id "; $ Wynik = pg_query ($ q) or die ("Zapytanie niepoprawne:". $ Q); $ Ilosc = pg_numrows ($ wynik); $ I = =; While ($ i & lt; $ ilosc) {$ id = pg_result ($ wynik, $ i, "id"); $ Lokalizacja = pg_result ($ wynik, $ i, "lokalizacja"); $ Ostatnie_logowanie = pg_result ($ wynik, $ i, "ostatnie_logowanie"); $ Profil_id = pg_result ($ wynik, $ i, "profil_id"); $ Adres_ip = pg_result ($ wynik, $ i, "adres_ip"); $ Position = pg_result ($ wynik, $ i, "status"); $ Adres_mac = pg_result ($ wynik, $ i, "adres_mac"); $ Wersja_programu = pg_result ($ wynik, $ i, "wersja_programu"); $ I ++; } Echo '& lt; Form action = "agent.php? Id = '. $ Id.' And zapisz 'method =" post "name =" formularz "> gt; div class =" control-group "> gt; & lt ; Label class = "control-label" & gt; Lokalizacja & lt; / label & gt; div class = "control"> gt; input type = "text" name = "localizax" value = "'. $ $ $ $ $ $ $ $ $ $ $ $ $ $ & Lt; P class = "help-block" & gt; & Lt; / P & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; Label class = "control-label" & gt; Profil & lt; / Label & gt; & Lt; Div class = "control" & gt; & Lt; Select class = "formularz_select" name = "profil_nazwa" id = "lista" & gt; '; Echo pobierz_profile ($ profil_id); Echo & lt; / Select & gt; & Lt; / Div & gt; & Lt; Button type = "submit" class = "btn btn-primary"> gtisz dan < / Button & gt; & Lt; / Form & gt; '; } // koniec EDYCJA Agenta // ZAPIS EDYCJA Agenta function zapisz ($ id) {if (isset ($ _post ['profil_nazwa'])) $ profil_nazwa = $ _POST ['profil_nazwa']; If (isset ($ _ POST ['Localizaka'])) $ $ $$ _POST ['Lokmanya']; If you select ID from profile (isset ($ _ post ['lokalizacja']) and isset ($ _ post ['profil_nazwa'])) {$ = zapytanie "profile where nazwa = '$ profil_nazwa'"; $ Oddoids = pg_query ($ zapatani) or die ("zeptienne napprave:". $ Zapatani); $ Id_profilu = pg_result ($ odpowiedz, 0, "id"); $ Q = "Update Effect FTIITI profile = '$ ID_profile', localization = '$ localization', condition = '1' WHERE id = $ id"; $ Wynik = pg_query ($ q) or die ("Zapytanie niepoprawne 1:". $ Q); ($ Wynik) {$ if global [komunikat_edycja_agenta] = "& lt; div id = \" myAlert \ "class = \" warning information - failure fade \ "& gt; & lt; a class = \" close \ "data -Discard = \ "WARNING \" & gt; × & lt; / a & gt; Adeja Zoconzona succumem & lt; / div & gt; "; } Else {$ global [komunikat_edycja_agenta] = "& lt; div id = \" myAlert \ "class = \" warning warning error fade \ "& gt; & lt; a square = \" close \ "data-reject = \ "Warning \" & gt; × & lt; / a & gt; Adeja Zoconzona Bladem & lt; / div & gt; "; }}} // Coniq zapisu adicaja agenda
I know that I need to use the input type file, but I have no clue how to save the path to the database and How to specify the folder for the uploaded file.
There are a few keys for the upload file:
-
& lt; Input type = 'file' name = 'file_name' / & gt;
should have this type of input; -
& lt; Form encrypt =
- You will need to use $ _FILES in the php server side to get the uploaded file, in this case, you can print $ _FILES ['file_name']] see the details Remember, the name value of the $ _FILES array key input ("FILE_NAME")
- The store file you need to use move_uploaded_file ($ temp_name, $ save_path) for the eq, $ save_path
To see an example, please go to:
Comments
Post a Comment