PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Webdev20 File Upload Not Working
Webdev20 File Upload Not Working
Débuté par EUGENE BOULIS, 28 jan. 2025 05:38 - 3 réponses
Membre enregistré
1 message
Posté le 28 janvier 2025 - 05:38
Please help I have Webdev 20 and I cannot get the file upload control to work, when I create a blank PHP page and create the single file upload control or even the multiple file upload control and I run the test, and click the Send button of the single file upload control or I click the Add file button of the multiple file upload control nothing happens. These two buttons should display the Windows Explorer file picker. I am using WAMP Server 2, PHP 5.5.12. Please help.
Message modifié, 28 janvier 2025 - 05:39
Posté le 28 janvier 2025 - 15:55
Hello

I see your problem, you want to download documents, it is programmable obviously, I have a very effective solution for you

1. You will need to have the document to download first, then you fill in the necessary information to download it

For this case here is a program model for you

// EDD (01/25): create a launch button and an upload field, you add an input field and then change the type to upload
// EDD (01/25): copy this program in the click of the button, you click the upload field before and after on the button

LOCAL
cUpload is ClUploader
cUpload:m_sChamp = "SSI_Upload"
cUpload:m_sNom = "UPL_" + Left(DateHeureSys(), 12)
cUpload:m_sRépertoire_Sauvegarde = fRepWeb() + "\Upload"
cUpload:Validation()
IF cUpload:m_bRetour = True THEN
cUpload:Lancement()
END

// EDD (01/25): create a new ClUploader class
ClUploader est une Classe
m_bRetour is booléen
m_sChamp is string
m_sNom is string
m_sRépertoire_Sauvegarde is string
FIN

// EDD (01/25): create two new methods in the ClUploader class
PROCÉDURE Validation()
:m_bRetour = True
IF NoSpace(:m_sChamp) = "" THEN
:m_bRetour = False
Info("Please fill in the blank field.")
ELSE IF ControlExist(:m_sChamp) = False THEN
:m_bRetour = False
Info("Please check the field not found." + RC + "'" + :m_sChamp + "'")
ELSE IF NoSpace(:m_sRépertoire_Sauvegarde) = "" THEN
:m_bRetour = False
Info("Please fill the empty backup directory.")
ELSE IF NoSpace(:m_sNom) = "" THEN
:m_bRetour = False
Info("Please fill in the blank document name.")
END
IF fDirExist(:m_sRépertoire_Sauvegarde) = False THEN
fMakeDir(:m_sRépertoire_Sauvegarde)
END

PROCÉDURE Lancement()
LOCAL
IF UploadCopieFichier({:m_sChamp, indChamp}, :m_sRépertoire_Sauvegarde, :m_sNom) = "" THEN
Info(ErreurInfo(errComplet))
EndProgram()
END
Info("Document upload successful.")

NB: Be careful about the document to download, there is a size limit so you should avoid large files if possible

Best regards
Mr.RATSIMANDRESY
Niry Aina Eddy
Posté le 24 février 2025 - 15:31
Thanks for your help, I have been trying to understand the code as it is written in French. I noted that this method allows only upload of one file at a time.

The problem is that the edit button of type upload only allows one file to be selected and cannot be set through the editor to handle multiple files (although it can be set through setting the multiple property to True through JScript).

Two questions:
1. Do you have another method that can upload multiple files?
2. Do you know a method of how on the server side we can access the multiple files uploaded through the edit control and save them to a directory?

Thanks
Posté le 24 février 2025 - 15:38
RATSIMANDRESY Niry Aina Eddy wrote:
Hello

I see your problem, you want to download documents, it is programmable obviously, I have a very effective solution for you

1. You will need to have the document to download first, then you fill in the necessary information to download it

For this case here is a program model for you

// EDD (01/25): create a launch button and an upload field, you add an input field and then change the type to upload
// EDD (01/25): copy this program in the click of the button, you click the upload field before and after on the button

LOCAL
cUpload is ClUploader
cUpload:m_sChamp = "SSI_Upload"
cUpload:m_sNom = "UPL_" + Left(DateHeureSys(), 12)
cUpload:m_sRépertoire_Sauvegarde = fRepWeb() + "\Upload"
cUpload:Validation()
IF cUpload:m_bRetour = True THEN
cUpload:Lancement()
END

// EDD (01/25): create a new ClUploader class
ClUploader est une Classe
m_bRetour is booléen
m_sChamp is string
m_sNom is string
m_sRépertoire_Sauvegarde is string
FIN

// EDD (01/25): create two new methods in the ClUploader class
PROCÉDURE Validation()
:m_bRetour = True
IF NoSpace(:m_sChamp) = "" THEN
:m_bRetour = False
Info("Please fill in the blank field.")
ELSE IF ControlExist(:m_sChamp) = False THEN
:m_bRetour = False
Info("Please check the field not found." + RC + "'" + :m_sChamp + "'")
ELSE IF NoSpace(:m_sRépertoire_Sauvegarde) = "" THEN
:m_bRetour = False
Info("Please fill the empty backup directory.")
ELSE IF NoSpace(:m_sNom) = "" THEN
:m_bRetour = False
Info("Please fill in the blank document name.")
END
IF fDirExist(:m_sRépertoire_Sauvegarde) = False THEN
fMakeDir(:m_sRépertoire_Sauvegarde)
END

PROCÉDURE Lancement()
LOCAL
IF UploadCopieFichier({:m_sChamp, indChamp}, :m_sRépertoire_Sauvegarde, :m_sNom) = "" THEN
Info(ErreurInfo(errComplet))
EndProgram()
END
Info("Document upload successful.")

NB: Be careful about the document to download, there is a size limit so you should avoid large files if possible

Best regards
Mr.RATSIMANDRESY
Niry Aina Eddy


Thanks very much for your help. I have been trying hard to understand the code as it is not written in English. I noted that this method can only upload 1 file at a time.

I have been trying to come up with a method to upload multiple files through the EDIT control of type Upload, the problem is that the Edit Control cannot be set to allow multiple file selection through the editor, although we can turn on the "multiple" property through JScript, then it will allow multiple files to be selected.

Two questions for you:
1. Do you know how on the server side we can access the multiple files submitted through the EDIT control and save them to a directory?
2. If not, do you know of another method we can use to upload multiple files?

Thanks.