Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 462565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:05:14+00:00 2026-05-12T23:05:14+00:00

I am creating an app which will be used to upload images to a

  • 0

I am creating an app which will be used to upload images to a specified server. I have created my GUI in Qt Designer, everything works fine I just am stuck on something that I know is simple. Cant seem to wrap my head around it.

The idea is for the script to go through and see how many text fields are filed in with paths of images – from there get each path and in order upload each one to server. I can make it work with just one box just fine but when i try to create a loop for this process it falls apart. I basically need to return ‘fullname’ with each different path. This is just a snippit but you get the idea..

The concept seems simple enough and I have rewritten this as many ways and I could find and think of. Any help would be awesome. Should I be using lists to do this instead or something?

        # count how many images there are going to be
    if not self.imgOnePathLabel.text().isEmpty():
        totalImages = 1
        # gets the path from IMAGE 1 box
        image1 = self.imgOnePathLabel.text()
        fullname = '%s' % image1
    if not self.imgTwoPathLabel.text().isEmpty():
        totalImages = 2
        image2 = self.img2PathLabel.text()
        fullname = '%s' % image2
    if not self.imgThreePathLabel.text().isEmpty():
        totalImages = 3
        imageThreePath = self.imgThreePathLabel.text()
        fullname = '%s' % imageThreePath
    try:
        for x in range(1,totalImages,1):
            # split end file from the file path
            name = os.path.split(fullname)[1]
            f = open(fullname, "rb")
            # store our selected file
            ftp.storbinary('STOR ' + name, f)
            msg = "Sent <font color=green>" + name + "</font>"
            self.logBrowser.append(msg)
            f.close()

    finally:
        msg = "<font color=green>" "Ok" "</font>"
        self.logBrowser.append(msg)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:05:14+00:00Added an answer on May 12, 2026 at 11:05 pm

    The issue you have is that you are assigning to the variable fullname three times overwriting it each time. So by the time you get to the for loop only have the last file name available if the last field has been set otherwise you get nothing at all. Your statement that you need a list of full names rather than one variable is correct. You need something like below:

        fullnames = []
        imageLabels = [self.imgOnePathLabel, self.imgTwoPathLabel,
                self.imgThreePathLabel]
        for imageLabel in imageLabels:
            if imageLabel.text():
                image = self.imgOnePathLabel.text()
                fullnames.append('%s' % image)
        try:
            for fullname in fullnames:
                # split end file from the file path
                name = os.path.split(fullname)[1]
                f = open(fullname, "rb")
                # store our selected file
                ftp.storbinary('STOR ' + name, f)
                msg = "Sent <font color=green>" + name + "</font>"
                self.logBrowser.append(msg)
                f.close()
        finally:
            msg = "<font color=green>" "Ok" "</font>"
            self.logBrowser.append(msg)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an app which will have a question in a UILabel and
I'm creating a gallery section for my app which will be used to show
I am creating an app for android which will be used by gym members.
I am creating an app that will require authentication which I have already gotten
I am currently creating a Dashboard app which is created with Ruby on Rails.
I am creating an iPhone app which I would like to have a similar
I'm creating a stateless session bean (the façade) which will be used for managing
I'm working on a mobile app with Phonegap which will use Geolocation. I used
I am creating a iPod app which will on multiple devices. For each user
I'm creating an app which requires the footer to remain constant among various activities.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.